aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/loslib.c b/loslib.c
index 6baebd91..95ec7395 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loslib.c,v 1.30 2010/07/02 11:38:13 roberto Exp roberto $ 2** $Id: loslib.c,v 1.31 2010/07/02 12:01:53 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*/
@@ -276,7 +276,11 @@ static int os_setlocale (lua_State *L) {
276 276
277 277
278static int os_exit (lua_State *L) { 278static int os_exit (lua_State *L) {
279 int status = luaL_optint(L, 1, EXIT_SUCCESS); 279 int status;
280 if (lua_isboolean(L, 1))
281 status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);
282 else
283 status = luaL_optint(L, 1, EXIT_SUCCESS);
280 if (lua_toboolean(L, 2)) 284 if (lua_toboolean(L, 2))
281 lua_close(L); 285 lua_close(L);
282 exit(status); 286 exit(status);