]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Create empty argv table when no args are passed to a Lua script
authorMichael Collins <msc@freeswitch.org>
Thu, 29 Jan 2009 23:39:47 +0000 (23:39 +0000)
committerMichael Collins <msc@freeswitch.org>
Thu, 29 Jan 2009 23:39:47 +0000 (23:39 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11559 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_lua/mod_lua.cpp

index 8a7aa89eb35189db66cb914838df790c1751ebde..a808d31edd0b4fb7724fa20ce5c3868c77b8b743 100644 (file)
@@ -156,7 +156,14 @@ static int lua_parse_and_execute(lua_State * L, char *input_code)
                                error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1);
                                switch_safe_free(code);
                        }
+               } else {
+                       // Force empty argv table
+                       char *code = NULL;
+                       code = switch_mprintf("argv = {};");
+                       error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1);
+                       switch_safe_free(code);
                }
+
                if (!error) {
                        char *file = input_code, *fdup = NULL;