diff options
| -rw-r--r-- | loslib.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.22 2007/09/14 13:26:28 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.23 2008/01/18 15:37:10 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -224,9 +224,13 @@ static int os_setlocale (lua_State *L) { | |||
| 224 | 224 | ||
| 225 | 225 | ||
| 226 | static int os_exit (lua_State *L) { | 226 | static int os_exit (lua_State *L) { |
| 227 | exit(luaL_optint(L, 1, EXIT_SUCCESS)); | 227 | int status = luaL_optint(L, 1, EXIT_SUCCESS); |
| 228 | if (!lua_toboolean(L, 2)) | ||
| 229 | lua_close(L); | ||
| 230 | exit(status); | ||
| 228 | } | 231 | } |
| 229 | 232 | ||
| 233 | |||
| 230 | static const luaL_Reg syslib[] = { | 234 | static const luaL_Reg syslib[] = { |
| 231 | {"clock", os_clock}, | 235 | {"clock", os_clock}, |
| 232 | {"date", os_date}, | 236 | {"date", os_date}, |
