lua-users home
lua-l archive

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


99% of our game is comprised of Lua tables with a few funciton objects and in fact every function has a table associated with it. That's why I need the funciton name in fact is to get at its object properties. Lua is seeing what it thinks is a function name in some cases and passing a function. The solution Ashwin proposed works great and so problem solved for the time being.
Cheers,
Brett

----- Original Message ----- 
From: "Jamie Webb" <j@jmawebb.cjb.net>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, March 05, 2004 7:55 PM
Subject: Re: function name


> On Friday 05 March 2004 04:52, Brett Bibby wrote:
> > Ashwin,
> > I'll give your suggestion a try. We need to do this because in our game all
> > scripts are objects and when called as functions they execute as you would
> > expect in Lua, but when they are used as parameters they always represent
> > object ids to our engine.  I need the name of the function to resolve its
> > object id in our engine. Cheers,
> 
> Wouldn't you be better off making your objects Lua tables and setting the 
> __call metamethod? I.e. have objects that behave like functions rather than 
> functions that behave like objects.
> 
> -- Jamie Webb