[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: finalizer not called for userdata created inside finalizer
- From: Josh Haberman <jhaberman@...>
- Date: Thu, 12 Apr 2012 16:11:58 -0700
On Wed, Apr 11, 2012 at 8:51 AM, Roberto Ierusalimschy
>> I see. In that case, using finalizers to implement a Lua-level
>> atexit() doesn't seem like a viable technique.
> It does, as long as you use 'atexit' for typical 'atexit' uses, such as
> cleaning up stuff. It really does not work if you want to run most of
> your program inside an 'atexit'.
Makes sense. Perhaps this behavior of finalizers could be documented
though? I spent a while trying to figure out why my __gc metamethod
was not being called, assuming that it must be a bug in my code. I
did visit the documentation about __gc to see if there was some
semantic I was misunderstanding.