lua-users home
lua-l archive

Re: Help needed calling Lua from my C function

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


Luiz,
Thanks. That may be it.
However, I'm using:
 lua_dobuffer( L, B, 1069, "'..id..'" );
Instead of loadfile. How does dobuffer() work with pcall()?
Mike
Luiz Henrique de Figueiredo wrote:
The error function myError doesn't get called.
 lua_pushcfunction(L,myError);
 lua_setglobal(L,"_ALERT");
Lua 5.1 no longer uses _ALERT. The correct idiom is something like
if (luaL_loadfile(L,"test.lua") || lua_pcall(L,0,0,0))
 fprintf(stderr,"%s\n",lua_tostring(L,-1));
This also holds for 5.0, though _ALERT was still available for
compatibility only.
--lhf

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