[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Best way to manage refs in C + Garbage collection in a single collectgarbage() call.
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 24 Jul 2008 13:13:57 -0300
> For the other problem, since I just used a userdata containing a
> pointer, the destructor just zeroes this. Other functions will see
> that as a NULL pointer. If you are wrapping some API you should add
> the check to the wrappers.
Another way, which I use in some of my libraries, is just to remove the
metatable in the explicit destructor or close. In this way, you can use
the close method as the method.