lua-users home
lua-l archive

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


1) When I call lua function from my C++ game, I use:

int result=lua_pcall(L,nargs,nresults,0);
if (result!=0)
        PrintError();

And it works perfectly. PrintError prints result and string taken from stack
(with lua_tostring(L,-1)).

2) When I run scripts with functions I call:

int result=lua_dofile(L, filename);

I can read result, but I can't read anything from stack. I know that file is
wrong, but I don't know why, I must check it by hand (sometimes it requires few
tries).

3) When I run command from user (game console) I call:

int result=lua_dostring(L,s);

Same problem - nothing on stack.

4) Why following script doesn't work?

function errorFallback(msg)
        s=string.format("lua error (callback): %s\n",msg);
        DevConPrint(s);
end;

setfallback('error',errorFallback);

-- 
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net