lua-users home
lua-l archive

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


They don't, but in Rici's version the metamethods are put on a standard Lua table, and the light user data is just an upvalue to these methods (which have been modified accordingly). So no metamethod is called on the userdata itself. 

-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Sam Roberts
Envoyé : 4 octobre 2006 17:39
À : lua@bazar2.conectiva.com.br
Objet : Re: Lua addition proposal: Userdata as function environment

On Wed, Oct 04, 2006 at 03:24:53PM -0500, Rici Lake wrote:
> Why not just use an empty table whose __index and __newindex methods 
> use the userdata? In effect, they could be the same __index and 
> __newindex metamethods you would use with the userdata.
> 
> The following hardly changes your example at all:
> 
> (Note: I'm using lightuserdata here, something I would normally never 
> do, but you don't seem to be attaching a __gc metamethod to your

I'm confused. I thought lightuserdata doesn't have an individual metatable?

Sam