lua-users home
lua-l archive

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

> if( lua_isFunctionPresent("fredname_IsDestroyed")
>       {
>       lua_fn = lua_getglobal("fredname_IsDestroyed");
>       lua_callfunction(lua_fn);
>       }

off the top of my head:

lua_fn = lua_getglobal("fredname_IsDestroyed");
if (lua_fn != LUA_NOOBJECT) {

I do exactly the same type of things for my game, and I cache the existence
of these callbacks, so I don't have to getglobal usually, except when the
Lua script adds/removed callbacks, in which cases it calls a routine to
the present callbacks and recache them.

Vincent Penquerc'h