sys.atexit
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)