lua-users home
lua-l archive

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

> I've scrutinized the reference manual and also done some web searching,
> and nowhere do I find the answer to this question: if Lua exits
> either by a call to os.exit or by a normal return from the main chunk,
> does it guarantee to call the __gc finalizers for any live userdata objects?

No and yes. The 'lua' applicative calls lua_close before returning,
and so clears everything. A call to os.exit skips that closing. We
thought about adding lua_close in an atexit function, but leaved as
it is so there is a way to skip lua_close if needed. (This may speed
up some programs which finish with lots of data to clean up.)

-- Roberto