aboutsummaryrefslogtreecommitdiff
path: root/src/luajit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/luajit.c')
-rw-r--r--src/luajit.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/luajit.c b/src/luajit.c
index 8c8cf9e6..1ca24301 100644
--- a/src/luajit.c
+++ b/src/luajit.c
@@ -124,7 +124,7 @@ static int docall(lua_State *L, int narg, int clear)
124#endif 124#endif
125 lua_remove(L, base); /* remove traceback function */ 125 lua_remove(L, base); /* remove traceback function */
126 /* force a complete garbage collection in case of errors */ 126 /* force a complete garbage collection in case of errors */
127 if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); 127 if (status != LUA_OK) lua_gc(L, LUA_GCCOLLECT, 0);
128 return status; 128 return status;
129} 129}
130 130
@@ -249,9 +249,9 @@ static void dotty(lua_State *L)
249 const char *oldprogname = progname; 249 const char *oldprogname = progname;
250 progname = NULL; 250 progname = NULL;
251 while ((status = loadline(L)) != -1) { 251 while ((status = loadline(L)) != -1) {
252 if (status == 0) status = docall(L, 0, 0); 252 if (status == LUA_OK) status = docall(L, 0, 0);
253 report(L, status); 253 report(L, status);
254 if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ 254 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */
255 lua_getglobal(L, "print"); 255 lua_getglobal(L, "print");
256 lua_insert(L, 1); 256 lua_insert(L, 1);
257 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) 257 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0)
@@ -273,7 +273,7 @@ static int handle_script(lua_State *L, char **argx)
273 if (strcmp(fname, "-") == 0 && strcmp(argx[-1], "--") != 0) 273 if (strcmp(fname, "-") == 0 && strcmp(argx[-1], "--") != 0)
274 fname = NULL; /* stdin */ 274 fname = NULL; /* stdin */
275 status = luaL_loadfile(L, fname); 275 status = luaL_loadfile(L, fname);
276 if (status == 0) { 276 if (status == LUA_OK) {
277 /* Fetch args from arg table. LUA_INIT or -e might have changed them. */ 277 /* Fetch args from arg table. LUA_INIT or -e might have changed them. */
278 int narg = 0; 278 int narg = 0;
279 lua_getglobal(L, "arg"); 279 lua_getglobal(L, "arg");
@@ -483,7 +483,7 @@ static int runargs(lua_State *L, char **argv, int argn)
483 default: break; 483 default: break;
484 } 484 }
485 } 485 }
486 return 0; 486 return LUA_OK;
487} 487}
488 488
489static int handle_luainit(lua_State *L) 489static int handle_luainit(lua_State *L)
@@ -494,7 +494,7 @@ static int handle_luainit(lua_State *L)
494 const char *init = getenv(LUA_INIT); 494 const char *init = getenv(LUA_INIT);
495#endif 495#endif
496 if (init == NULL) 496 if (init == NULL)
497 return 0; /* status OK */ 497 return LUA_OK;
498 else if (init[0] == '@') 498 else if (init[0] == '@')
499 return dofile(L, init+1); 499 return dofile(L, init+1);
500 else 500 else
@@ -539,17 +539,17 @@ static int pmain(lua_State *L)
539 539
540 if (!(flags & FLAGS_NOENV)) { 540 if (!(flags & FLAGS_NOENV)) {
541 s->status = handle_luainit(L); 541 s->status = handle_luainit(L);
542 if (s->status != 0) return 0; 542 if (s->status != LUA_OK) return 0;
543 } 543 }
544 544
545 if ((flags & FLAGS_VERSION)) print_version(); 545 if ((flags & FLAGS_VERSION)) print_version();
546 546
547 s->status = runargs(L, argv, argn); 547 s->status = runargs(L, argv, argn);
548 if (s->status != 0) return 0; 548 if (s->status != LUA_OK) return 0;
549 549
550 if (s->argc > argn) { 550 if (s->argc > argn) {
551 s->status = handle_script(L, argv + argn); 551 s->status = handle_script(L, argv + argn);
552 if (s->status != 0) return 0; 552 if (s->status != LUA_OK) return 0;
553 } 553 }
554 554
555 if ((flags & FLAGS_INTERACTIVE)) { 555 if ((flags & FLAGS_INTERACTIVE)) {