lua-users home
lua-l archive

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


>If a Lua script wants to exit
>cleanly, it should return from its main chunk. If it wants to 
exit
>quickly, it should call os.exit().

Unfortunately, this is not always a suitable situation. For 
example, one place where I use Lua scripts a lot is in SVN post-
commit hooks where I need the ability to have the Lua 
interpreter return a non-zero status code. I use os.exit() to do 
this; the only other way to get a non-zero status at exit would 
be to throw an uncaught error, which results in messages 
appearing client-side which looks like a server error instead of 
a user error.