diff mbox series

[01/11] Lua: expose get_tmpdir() to Lua

Message ID 20171103123009.18705-1-christian.storm@siemens.com
State Accepted
Headers show
Series [01/11] Lua: expose get_tmpdir() to Lua | expand

Commit Message

Storm, Christian Nov. 3, 2017, 12:29 p.m. UTC
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(+)

Comments

Stefano Babic Nov. 7, 2017, 4:18 p.m. UTC | #1
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 mbox series

Patch

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 },