lua-users home
lua-l archive

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


I encountereed a problem with executing a chunk several times:

I load a script from a file by executing luaL_loadfile().
As I see, it is put on the stack as a function.
Now I set some global data as input for the script
and then run it by lua_pcall().
After popping the results from the stack, the stack is 
empty, because the lua_pcall() popped also the 
function from the stack.

I would like to execute the chunk a second and more times,
but I couldn't find out, how to preserve it and push it
back onto the stack for subsequent pcalls.

What did I miss?