mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
"exit" has an optional parameter of status.
This commit is contained in:
parent
0ef5cf2289
commit
f37e65d1cb
1 changed files with 3 additions and 4 deletions
7
iolib.c
7
iolib.c
|
|
@ -3,7 +3,7 @@
|
|||
** Input/output library to LUA
|
||||
*/
|
||||
|
||||
char *rcs_iolib="$Id: iolib.c,v 1.39 1996/03/14 15:55:18 roberto Exp roberto $";
|
||||
char *rcs_iolib="$Id: iolib.c,v 1.40 1996/03/19 22:28:37 roberto Exp roberto $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -529,9 +529,8 @@ static void io_date (void)
|
|||
static void io_exit (void)
|
||||
{
|
||||
lua_Object o = lua_getparam(1);
|
||||
if (lua_isstring(o))
|
||||
fprintf(stderr, "%s\n", lua_getstring(o));
|
||||
exit(1);
|
||||
int code = lua_isnumber(o) ? (int)lua_getnumber(o) : 1;
|
||||
exit(code);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue