From: Michael Collins Date: Thu, 29 Jan 2009 23:39:47 +0000 (+0000) Subject: Create empty argv table when no args are passed to a Lua script X-Git-Tag: v1.0.3~517 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a701745e0d6ebc684bf15bd675c67fb958008613;p=thirdparty%2Ffreeswitch.git Create empty argv table when no args are passed to a Lua script git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11559 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 8a7aa89eb3..a808d31edd 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -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;