From a701745e0d6ebc684bf15bd675c67fb958008613 Mon Sep 17 00:00:00 2001 From: Michael Collins Date: Thu, 29 Jan 2009 23:39:47 +0000 Subject: [PATCH] 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 --- src/mod/languages/mod_lua/mod_lua.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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;