[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Testing for the presence of lua functions from C
- From: Edgar Toernig <froese@...>
- Date: Mon, 19 Feb 2001 22:17:23 +0100
bwalmisley@btinternet.com wrote:
>
> So when "fredname" is destroyed something like:
>
> if( lua_isFunctionPresent("fredname_IsDestroyed")
> {
> lua_fn = lua_getglobal("fredname_IsDestroyed");
> lua_callfunction(lua_fn);
> }
lua_getglobal(L, "fredname_IsDestroyed"); // you get nil if undefined
if (lua_type(L, -1) != LUA_TNIL) // or: ... == LUA_TFUNCTION
lua_call(L, 0, 0);
else
lua_pop(L, 1);
Ciao, ET.