|  | ||
| 
 | 
> a = {__gc = function() print'exit' end}
> setmetatable(a,a)
> os.exit()
> 
> -> nothing to print.
> But if i exit with combination <Ctrl+d>  all Ok.
os.exit() terminates the process there and then.
<Ctrl+d> terminates the session cleanly, calling lua_close,
which then calls the GC methods.