Warning
The function will be called from another thread than the current program thread, and behaviour may be unpredictable if you use external binary modules or API from the body of the function.
sys.atexit read/write property
The sys.atexit property get or set the function to be called at program exit. This function don't take any arguments.
Example
sys.atexit = function()
print("You are leaving LuaRT !")
end
--- Very long sleep, press CTRL+C to force program exit (and call sys.atexit function)
sleep(100000)