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
This commit is contained in:
Michael Collins 2009-01-29 23:39:47 +00:00
parent ce0fc12824
commit a701745e0d

View 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;