[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Calling a function on exit
- From: Bernhard Bliem <bernhard.bliem@...>
- Date: Thu, 10 Jun 2004 01:56:54 +0200
Hello,
I've written a little wrapper to use SDL from within Lua scripts. When I
use SDL with C, I usually call atexit(SDL_Quit) after I initialized it.
I have to call SDL_Quit on exit, because bad things could happen if I don't.
However, since I initialize SDL in Lua, I have to make sure SDL_Quit
(i.e. my wrapper function for it) gets called whenever the chunk
execution ends. If there is an error in my script and it aborts, the
program terminates without calling SDL_Quit. Is there some kind of
"atexit" function for Lua? I have looked at hooks, but they don't seem
to be made for this purpose. Unfortunately it is not an option to check
if SDL_Quit has to be called by the interpreter after the script
execution has ended.
Regards,
Bernhard