[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Userdata example for 5.2.2
- From: Garthy <garthy_aul@...>
- Date: Fri, 19 Apr 2013 09:20:41 +0930
On 19/04/13 09:07, Luiz Henrique de Figueiredo wrote:
There doesn't seem to be a "__gc" call though- would I be correct in
assuming that it isn't there as MT doesn't really need specific cleanup
during garbage collection?
Yes. Anyone using MT must provide a struct to it. lrandom uses
lua_newuserdata to allocate one; this memory is fully managed by Lua.
OTOH, lgdbm uses handles provided by gdbm and so must register a gc method
for closing the databases when the handle is collected in Lua.
Excellent, thanks for the clarification. I'll also check out lgdbm for a
gc example- thankyou again for the useful information.