lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>xxx,yyy = dofile()
>print(xxx)
>print(yyy)
>
>    I type "return 1,2,3,4,5" and i see on the stdout "2" followed by "3"...

You've found a bug. :-(

Here is a quick fix: change luaB_dofile in src/lib/lbaselib.c to this:

 static int luaB_dofile (lua_State *L) {
   const char *fname = luaL_optstring(L, 1, NULL);
   int n=lua_gettop(L);                                 <<< new code
   int status = luaL_loadfile(L, fname);
   if (status != 0) lua_error(L);
   lua_call(L, 0, LUA_MULTRET);
   return lua_gettop(L) - n;                            <<< fixed code
 }

An official patch will appear soon in the bugs page in the web site and
will be included in Lua 5.0.1 (which will be released by February).

Thanks.
--lhf