The following changes allow Lua programs to use the ... construct instead of
using the obsolete arg variable.
vg:
given the program test.lua
print(#arg)
print(#...)
wxlua -c -r test.lua 1 2 3
will produce
3
3
instead of an error
int wxLuaState::RunFile(const wxString &filename, int nresults)
{
lua_State* L = M_WXLSTATEDATA->m_lua_State;
wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Lua interpreter not created"));
wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN,
wxT("Lua interpreter is already running"));
M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false;
M_WXLSTATEDATA->m_wxlStateData->m_is_running = true;
int top = lua_GetTop();
int status = luaL_LoadFile(wx2lua(filename));
if (status == 0)
{
lua_getglobal(L, "arg");
status = LuaPCall(1, nresults); // no args and nresults
}
else
SendLuaErrorEvent(status, top); // compilation error
----------------------------------------------------------------
The following change increase the compatibility between wxlua and lua
int wxlua_pushargs(lua_State* L, wxChar **argv, int argc, int start_n)
{
if (argc == 0) return 0;
int i = 0;
int narg = argc - (start_n + 1); // number of arguments to the script
if (narg == 0) return 0;
----------------
This implies that no arguments are created if no arguments are received which
is
the way Lua is implemented.
test.lua can be used for testing
wxlua -c -r test.lua
will issue an error similar to lua
Andre
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users