lua-users home
lua-l archive

Re: Call module function from C

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


On Tue, 2007年12月18日 at 01:31 -0800, Tony Paloma wrote:
First up, instead of:
> lua_getglobal(GetLuaState(), "hook.Call");
Try:
lua_getglobal(GetLuaState(), "hook");
lua_pushliteral(GetLuaState(), "Call");
lua_gettable(GetLuaState(), -2);
lua_remove(GetLuaState(), -2);
Also, I'd be tempted to stuff a lua_State *L = GetLuaState() at the top,
unless GetLuaState is a correctly consted function such that the
compiler can optimise away calls to it.
D.
-- 
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895

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