[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Testing for the presence of lua functions from C
- From: miles <miles@...>
- Date: Mon, 19 Feb 2001 17:52:20 -0800 (PST)
How about this?
if (fredname_IsDestroyed) then
Miles Johnson [email@example.com]
When you put down one mother, you puttin down mothers all over the world!
-- Mr T.
On Mon, 19 Feb 2001 firstname.lastname@example.org wrote:
> I'm considering doing some sort of callbacks from my game to the
> level script (for events). What I need is some kind of
> What I'm considering is something along the lines of:
> function LoadLevel()
> -- do stuff
> object = LoadObject("object\fred.x","fredname")
> function fredname_IsDestroyed()
> -- do something
> function fredname_IsHitByEnemy()
> -- do something else
> So when "fredname" is destroyed something like:
> if( lua_isFunctionPresent("fredname_IsDestroyed")
> lua_fn = lua_getglobal("fredname_IsDestroyed");
> gets called.
> Am I barking up the wrong tree here? No doubt the lua gods will say
> theres some devastatingly simple way to do it (there usually is...)
> but I cannot find it.