[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Testing for the presence of lua functions from C
- From: "Vincent Penquerc'h" <vincent@...>
- Date: Mon, 19 Feb 2001 15:33:36 -0000
> 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) {
lua_callfunction(lua_fn);
}
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
reread
the present callbacks and recache them.
--
Vincent Penquerc'h