lua-users home
lua-l archive

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


On Fri, Mar 14, 2014 at 09:12:16AM -0400, Rena wrote:
> I also find it pretty odd that os.exit() doesn't close the state by
> default. That's just asking for cleanup handlers for objects to not get
> called, leaving things like temporary files and database connections laying
> around.

Except the OS will close any network connections that are open, and if
you did your temporary file right, it will be ephemeral and will also
vanish on exit.

On older versions of Lua, you can of course just try to iterate _G and
destroy everything (except the os table) before calling os.exit() if
you're concerned.  (Bonus points for doing the same to the registry.)

B.