[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: finalizer not called for userdata created inside finalizer
- From: Josh Haberman <jhaberman@...>
- Date: Wed, 11 Apr 2012 08:39:51 -0700
On Wed, Apr 11, 2012 at 6:07 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> It does not seem a good practice to create new resources when finalizing
> something, and it can easily create an infinite loop. So, to avoid
> infinite loops, Lua does not call the finalizers of objects created
> after the call to lua_close.
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
Is there any other way to accomplish this? It's nice in the case of
lunitx to define an arbitrary number of test_*() functions and then
have lunitx run whatever set of functions were defined. It makes it
easy to combine tests in different files into one large suite without
worry about who will will call lunit.main(). You don't have to invoke
Lua in any special way; you can just say "lua mytest1.lua
mytest2.lua".
Josh