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.