Message ID | 20171103123009.18705-1-christian.storm@siemens.com |
---|---|
State | Accepted |
Headers | show |
Series | [01/11] Lua: expose get_tmpdir() to Lua | expand |
On 03/11/2017 13:29, Christian Storm wrote: > Expose get_tmpdir() to Lua as swupdate.tmpdir() function. > > Signed-off-by: Christian Storm <christian.storm@siemens.com> > --- > corelib/lua_interface.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c > index 5c2a36e..a41629f 100644 > --- a/corelib/lua_interface.c > +++ b/corelib/lua_interface.c > @@ -369,12 +369,21 @@ static int l_info(lua_State *L) { > return 0; > } > > +#ifdef CONFIG_HANDLER_IN_LUA > +static int l_get_tmpdir(lua_State *L) > +{ > + lua_pushstring(L, get_tmpdir()); > + return 1; > +} > +#endif > + > /** > * @brief array with the function which are exported to Lua > */ > static const luaL_Reg l_swupdate[] = { > #ifdef CONFIG_HANDLER_IN_LUA > { "register_handler", l_register_handler }, > + { "tmpdir", l_get_tmpdir }, > #endif > { "notify", l_notify }, > { "error", l_error }, > Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index 5c2a36e..a41629f 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -369,12 +369,21 @@ static int l_info(lua_State *L) { return 0; } +#ifdef CONFIG_HANDLER_IN_LUA +static int l_get_tmpdir(lua_State *L) +{ + lua_pushstring(L, get_tmpdir()); + return 1; +} +#endif + /** * @brief array with the function which are exported to Lua */ static const luaL_Reg l_swupdate[] = { #ifdef CONFIG_HANDLER_IN_LUA { "register_handler", l_register_handler }, + { "tmpdir", l_get_tmpdir }, #endif { "notify", l_notify }, { "error", l_error },
Expose get_tmpdir() to Lua as swupdate.tmpdir() function. Signed-off-by: Christian Storm <christian.storm@siemens.com> --- corelib/lua_interface.c | 9 +++++++++ 1 file changed, 9 insertions(+)