[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: Testing for the presence of lua functions from C
From: miles <miles () spaceninja ! com>
Date: 2001-02-20 1:52:20
Message-ID: Pine.BSF.4.10.10102191749030.566-100000 () fojar ! com
[Download RAW message or body]
How about this?
if (fredname_IsDestroyed) then
fredname_IsDestroyed()
end
Miles Johnson [miles@spaceninja.com]
When you put down one mother, you puttin down mothers all over the world!
-- Mr T.
On Mon, 19 Feb 2001 bwalmisley@btinternet.com 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
> lua_isFunctionPresent.
>
> What I'm considering is something along the lines of:
>
> function LoadLevel()
> -- do stuff
> object = LoadObject("object\fred.x","fredname")
> --
> end
>
> function fredname_IsDestroyed()
> -- do something
> end
>
> function fredname_IsHitByEnemy()
> -- do something else
> end
>
> So when "fredname" is destroyed something like:
>
> if( lua_isFunctionPresent("fredname_IsDestroyed")
> {
> lua_fn = lua_getglobal("fredname_IsDestroyed");
> lua_callfunction(lua_fn);
> }
>
> 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.
>
> Benedict
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic