On Mon, Aug 23, 2010 at 9:39 PM, AndreArpin <ar...@kingston.net> wrote:
> AndreArpin <ar...@...> writes:
>
>> The following changes allow Lua programs to use the ... construct instead of
>> using the obsolete arg variable.

I see that that the Lua 5.1.4 (the current Lua) that wxLua uses pushes
the global table "arg" in wxLua/modules/src/lua.c. Is the "..."
construct in 5.2?

> int wxLuaState::RunFile(const wxString &filename, int nresults)

I don't think this function should push an "arg" table for each Lua
file executed. It's unclear to me what would be in the "arg" table. In
the wxLua apps wxLua and wxLuaFreeze the "arg" table is created from
the command line params, but a C++ app that uses wxLua to run scripts
may not have an "arg" table at all. In fact this function may be run
after user code has been run which may have changed the "arg" table.

I do think there should be a way to put args on the stack for the
RunFile() function. Maybe the function should have this signature:

int wxLuaState::RunFile(const wxString &filename, int nresults, int nargs)
...

  int status = luaL_LoadFile(wx2lua(filename));
  if (status == 0)
  {
       if (nargs > 0) lua_Insert(nargs); // put compiled script below args
       status = LuaPCall(nargs, nresults); // nargs and nresults

Regards,
    John Labenski

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to