[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: anti...require?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 31 Jan 2009 17:31:43 -0200
> > You cannot set __gc for tables. But you can say use a udata as upvalue for
> > all functions registered in the module and then clean up when that udata
> > is collected.
>
>
> I have also thought about what to do in this situation and I am still
> learning these tricks. Any examples would be very helpful. Thanks.
See loadlib.c, which sets __gc for library handles to tell the OS to
unload libraries from the app when they become garbage in Lua. This is
not the same technique I described above, though.