[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Object binding system vs LUA_REGISTRYINDEX
- From: "Brian Weed" <bw@...>
- Date: Tue, 17 Apr 2007 19:30:25 -0400
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.