lua-users home
lua-l archive

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


Yeah, one of the coolest features of Lua is using stuff as keys, indices, etc. :) I thought since the function name was already hanging around I would just use that unless there is a performance gain to be had by using the function as an index. If I did it that way, would Lua consider the function as an index in the same way as say light user data? Or is there a special relationship that functions have as indices?

Also, how would I get the funciton name in the beginning to use it as an index? The reason I hadn't just made keys of the functions is that at load time the function is embedded in a chunk and I don't have a real good way of knowing the function is even there until it gets passed in as a paramter.

Brett

----- Original Message ----- 
From: "Roberto Ierusalimschy" <roberto@inf.puc-rio.br>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, March 05, 2004 8:58 PM
Subject: Re: function name 


> > That's why I need the funciton name in fact is to get at its object
> > properties.
> 
> As an alternative solution, remember that you can use the functions
> themselves as indices in a table. So you can use a table
> "function->properties" to keep that relationship.
> 
> -- Roberto