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]


> 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 によって変換されたページ (->オリジナル) /