lua-users home
lua-l archive

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

Gé Weijers wrote:
Could you give us a bit more information? I believe about everyone who answered you answered a different question :-)

I can think of two different scenarios:

1) you have a Lua userdata object implemented in C++ that needs a Lua table to represent methods written in Lua. In that case Rici's suggestion would work: store the data in the object's environment. Alternatively (e.g. for Lua 5.0) you could use a separate weak table with your userdata object as the weak key, and the table as the (strong) value. The weak table could be stored in the registry or the module's environment, your choice.

Yes, #1, thats me. Although I'm using 5.1.1, I'm thinking I will store a weak table in the registry that contains my pointer-table lookups.