lua-users home
lua-l archive

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

> > 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.
> Mark

Ah, I feel a previous thread that I didn't pay enough attention to sneaking
back up on me. :-)

Yes it sounds like I need to go back through the archives and reread some of
the threads on weak tables.  This was probably what originally fixed the
"fronting a Lua table as the object" approach in my mind.  However, I don't
much like this for general app extension purposes because of the "security"