lua-users home
lua-l archive

Re: lua_compilestring()

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


Luiz Henrique de Figueiredo wrote:
> 
> In 4.0, you can wrap you string inside "return function () XXX end",
> where "XXX" is your string.
> Run lua_dostring once on the extended string and then lua_call the result
> many times. (The result is left on the stack after lua_dostring.)
Please correct me if I'm wrong, but lua_call pops all the arguments AND
the function value from the stack. And so I must give the function a
name, in order to access it more than once...
Right now I'm using
"function userfunc() XXX end"
then lua_getglobal(LS, "userfunc"); lua_call(LS, 0, 0);
Oscar Lazzarino

AltStyle によって変換されたページ (->オリジナル) /