[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: about objects freeing tagmethod resources, etc
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 09 Nov 2000 16:04:53 -0200
> However one unavoidable case is when it's necessary to
> free some system resource (other than memory) claimed at object
> construction.
You can always associtate a userdata with the resource, and use its
GC tag method. For instance, you can put the userdata as a field of
a table, so that its GC tag method will be called when the table is
collected.
> It would be nice if Lua had support for weak references.
The C API does support weak references. It is not difficult to export
this facility to Lua.
-- Roberto