[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Module finalization (along the lines of calling a function on exit)
- From: Rici Lake <lua@...>
- Date: Fri, 19 Aug 2005 07:15:28 -0500
On 19-Aug-05, at 7:04 AM, Antero Vipunen wrote:
Ok. Then why not to do the following: create a userdata with proper
__gc metametod(it's only destiny will be to assure the proper
finalization), and assign it to some field of module, or set as
upvalue for one of the module functions(for example Z_init()). When
the module gets collected then so does it's fields...
You probably meant "all of the module functions". It is conceivable
that one of the module functions could be collected while the other
ones are still in use. For example, what happens if the module table
gets collected, but some program has retained a reference to some
module function.