[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __gc visible to lua code...
- From: Tomas Guisasola Gorham <tomas@...>
- Date: Fri, 30 Mar 2007 15:09:41 -0300 (BRT)
> > I think it is best to just keep track of the state of your userdata
> > and any associated resources. For example: if your userdata is a
> > struct, add a field to mark when it is finalized. If your userdata
> > is a boxed pointer, make sure you nullify the pointer when you are
> > done with it.
We do exactly this in the implementation of LuaSQL.
> Yes, I've done this now... but still I think __gc should be private
> by default.
In LuaSQL, the `close' method and the `__gc' metamethod are
the same C function. Do you have a better idea?
Tomás