lua-users home
lua-l archive

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


on 3/25/04 9:52 AM, Virgil Smith at Virgil@Nomadics.com wrote:

> For per userdata instance Lua data I recommend using a weak keyed table
> inside the metatable for the userdata "type".  This way the metatable
> uniqueness is still a "type identifier", but per instance data is easily
> accessed.

So

    getmetatable( ud ).linkedData[ ud ]

Where linkedData is weak-keyed?

The problem is that this is prone to reference cycles since the value side
of the table will all be marked.

Or did you have something else in mind?

Mark