lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Apr 11, 2012 at 8:51 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> I see.  In that case, using finalizers to implement a Lua-level
>> atexit() doesn't seem like a viable technique.
>>
>> https://github.com/dcurrie/lunit/blob/master/atexit.lua
>
> 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.

Thanks,
Josh