[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: question: userdata cross references ?
- From: Sam Roberts <vieuxtech@...>
- Date: Fri, 18 Dec 2009 14:22:27 -0800
On Fri, Dec 18, 2009 at 2:06 PM, Francesco Abbate <gslshell@gmail.com> wrote:
> I was thinking that it would be nice if the userdata could store one
> or more reference to other userdata objects in order to ensure that
> the GC does not free the main object that own the resource if other
> objects that need the same resource are still alive. In my idea the C
> API could be something like:
Use lua_setfenv() to attach a table to your userdata.
In that table, put a reference to the userdata you want to not be available
for garbage collection while this new userdata exists.
Cheers,
Sam