2
0
Roberto Ierusalimschy 19 жил өмнө
parent
commit
afa0d0ac0d
7 өөрчлөгдсөн 54 нэмэгдсэн , 53 устгасан
  1. 8 8
      lbaselib.c
  2. 7 7
      ldo.c
  3. 2 4
      loadlib.c
  4. 4 4
      lstate.c
  5. 4 4
      ltests.c
  6. 26 24
      lua.c
  7. 3 2
      lua.h

+ 8 - 8
lbaselib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lbaselib.c,v 1.191 2006/06/02 15:34:00 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.192 2006/09/11 14:07:24 roberto Exp roberto $
 ** Basic library
 ** Basic library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -264,7 +264,7 @@ static int luaB_ipairs (lua_State *L) {
 
 
 
 
 static int load_aux (lua_State *L, int status) {
 static int load_aux (lua_State *L, int status) {
-  if (status == 0)  /* OK? */
+  if (status == LUA_OK)
     return 1;
     return 1;
   else {
   else {
     lua_pushnil(L);
     lua_pushnil(L);
@@ -325,7 +325,7 @@ static int luaB_load (lua_State *L) {
 static int luaB_dofile (lua_State *L) {
 static int luaB_dofile (lua_State *L) {
   const char *fname = luaL_optstring(L, 1, NULL);
   const char *fname = luaL_optstring(L, 1, NULL);
   int n = lua_gettop(L);
   int n = lua_gettop(L);
-  if (luaL_loadfile(L, fname) != 0) lua_error(L);
+  if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L);
   lua_call(L, 0, LUA_MULTRET);
   lua_call(L, 0, LUA_MULTRET);
   return lua_gettop(L) - n;
   return lua_gettop(L) - n;
 }
 }
@@ -373,7 +373,7 @@ static int luaB_pcall (lua_State *L) {
   int status;
   int status;
   luaL_checkany(L, 1);
   luaL_checkany(L, 1);
   status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0);
   status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0);
-  lua_pushboolean(L, (status == 0));
+  lua_pushboolean(L, (status == LUA_OK));
   lua_insert(L, 1);
   lua_insert(L, 1);
   return lua_gettop(L);  /* return status + all results */
   return lua_gettop(L);  /* return status + all results */
 }
 }
@@ -385,7 +385,7 @@ static int luaB_xpcall (lua_State *L) {
   lua_settop(L, 2);
   lua_settop(L, 2);
   lua_insert(L, 1);  /* put error function under function to be called */
   lua_insert(L, 1);  /* put error function under function to be called */
   status = lua_pcall(L, 0, LUA_MULTRET, 1);
   status = lua_pcall(L, 0, LUA_MULTRET, 1);
-  lua_pushboolean(L, (status == 0));
+  lua_pushboolean(L, (status == LUA_OK));
   lua_replace(L, 1);
   lua_replace(L, 1);
   return lua_gettop(L);  /* return status + all results */
   return lua_gettop(L);  /* return status + all results */
 }
 }
@@ -481,13 +481,13 @@ static int auxresume (lua_State *L, lua_State *co, int narg) {
   int status;
   int status;
   if (!lua_checkstack(co, narg))
   if (!lua_checkstack(co, narg))
     luaL_error(L, "too many arguments to resume");
     luaL_error(L, "too many arguments to resume");
-  if (lua_status(co) == 0 && lua_gettop(co) == 0) {
+  if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) {
     lua_pushliteral(L, "cannot resume dead coroutine");
     lua_pushliteral(L, "cannot resume dead coroutine");
     return -1;  /* error flag */
     return -1;  /* error flag */
   }
   }
   lua_xmove(L, co, narg);
   lua_xmove(L, co, narg);
   status = lua_resume(co, narg);
   status = lua_resume(co, narg);
-  if (status == 0 || status == LUA_YIELD) {
+  if (status == LUA_OK || status == LUA_YIELD) {
     int nres = lua_gettop(co);
     int nres = lua_gettop(co);
     if (!lua_checkstack(L, nres))
     if (!lua_checkstack(L, nres))
       luaL_error(L, "too many results to resume");
       luaL_error(L, "too many results to resume");
@@ -565,7 +565,7 @@ static int luaB_costatus (lua_State *L) {
       case LUA_YIELD:
       case LUA_YIELD:
         lua_pushliteral(L, "suspended");
         lua_pushliteral(L, "suspended");
         break;
         break;
-      case 0: {
+      case LUA_OK: {
         lua_Debug ar;
         lua_Debug ar;
         if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */
         if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */
           lua_pushliteral(L, "normal");  /* it is running */
           lua_pushliteral(L, "normal");  /* it is running */

+ 7 - 7
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 2.42 2006/09/11 14:07:24 roberto Exp roberto $
+** $Id: ldo.c,v 2.43 2006/09/19 13:57:50 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -110,7 +110,7 @@ void luaD_throw (lua_State *L, int errcode) {
 int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
 int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
   unsigned short oldnCcalls = G(L)->nCcalls;
   unsigned short oldnCcalls = G(L)->nCcalls;
   struct lua_longjmp lj;
   struct lua_longjmp lj;
-  lj.status = 0;
+  lj.status = LUA_OK;
   lj.previous = L->errorJmp;  /* chain new error handler */
   lj.previous = L->errorJmp;  /* chain new error handler */
   L->errorJmp = &lj;
   L->errorJmp = &lj;
   LUAI_TRY(L, &lj,
   LUAI_TRY(L, &lj,
@@ -391,14 +391,14 @@ void luaD_call (lua_State *L, StkId func, int nResults) {
 static void resume (lua_State *L, void *ud) {
 static void resume (lua_State *L, void *ud) {
   StkId firstArg = cast(StkId, ud);
   StkId firstArg = cast(StkId, ud);
   CallInfo *ci = L->ci;
   CallInfo *ci = L->ci;
-  if (L->status == 0) {  /* start coroutine? */
+  if (L->status == LUA_OK) {  /* start coroutine? */
     lua_assert(ci == L->base_ci && firstArg > L->base);
     lua_assert(ci == L->base_ci && firstArg > L->base);
     if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)
     if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)
       return;
       return;
   }
   }
   else {  /* resuming from previous yield */
   else {  /* resuming from previous yield */
     lua_assert(L->status == LUA_YIELD);
     lua_assert(L->status == LUA_YIELD);
-    L->status = 0;
+    L->status = LUA_OK;
     if (!f_isLua(ci)) {  /* `common' yield? */
     if (!f_isLua(ci)) {  /* `common' yield? */
       /* finish interrupted execution of `OP_CALL' */
       /* finish interrupted execution of `OP_CALL' */
       lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
       lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
@@ -426,7 +426,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
   int status;
   int status;
   lua_lock(L);
   lua_lock(L);
   if (L->status != LUA_YIELD) {
   if (L->status != LUA_YIELD) {
-    if (L->status != 0)
+    if (L->status != LUA_OK)
       return resume_error(L, "cannot resume dead coroutine");
       return resume_error(L, "cannot resume dead coroutine");
     else if (L->ci != L->base_ci)
     else if (L->ci != L->base_ci)
       return resume_error(L, "cannot resume non-suspended coroutine");
       return resume_error(L, "cannot resume non-suspended coroutine");
@@ -437,7 +437,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
       return resume_error(L, "C stack overflow");
       return resume_error(L, "C stack overflow");
   L->baseCcalls = ++G(L)->nCcalls;
   L->baseCcalls = ++G(L)->nCcalls;
   status = luaD_rawrunprotected(L, resume, L->top - nargs);
   status = luaD_rawrunprotected(L, resume, L->top - nargs);
-  if (status != 0) {  /* error? */
+  if (status != LUA_OK) {  /* error? */
     L->status = cast_byte(status);  /* mark thread as `dead' */
     L->status = cast_byte(status);  /* mark thread as `dead' */
     luaD_seterrorobj(L, status, L->top);
     luaD_seterrorobj(L, status, L->top);
     L->ci->top = L->top;
     L->ci->top = L->top;
@@ -473,7 +473,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u,
   ptrdiff_t old_errfunc = L->errfunc;
   ptrdiff_t old_errfunc = L->errfunc;
   L->errfunc = ef;
   L->errfunc = ef;
   status = luaD_rawrunprotected(L, func, u);
   status = luaD_rawrunprotected(L, func, u);
-  if (status != 0) {  /* an error occurred? */
+  if (status != LUA_OK) {  /* an error occurred? */
     StkId oldtop = restorestack(L, old_top);
     StkId oldtop = restorestack(L, old_top);
     luaF_close(L, oldtop);  /* close possible pending closures */
     luaF_close(L, oldtop);  /* close possible pending closures */
     luaD_seterrorobj(L, status, oldtop);
     luaD_seterrorobj(L, status, oldtop);

+ 2 - 4
loadlib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: loadlib.c,v 1.54 2006/07/03 20:16:49 roberto Exp roberto $
+** $Id: loadlib.c,v 1.55 2006/09/11 14:07:24 roberto Exp roberto $
 ** Dynamic library loader for Lua
 ** Dynamic library loader for Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 **
 **
@@ -89,8 +89,6 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
 ** =======================================================================
 ** =======================================================================
 */
 */
 
 
-#include <windows.h>
-
 
 
 #undef setprogdir
 #undef setprogdir
 
 
@@ -382,7 +380,7 @@ static int loader_Lua (lua_State *L) {
   const char *name = luaL_checkstring(L, 1);
   const char *name = luaL_checkstring(L, 1);
   filename = findfile(L, name, "path");
   filename = findfile(L, name, "path");
   if (filename == NULL) return 1;  /* library not found in this path */
   if (filename == NULL) return 1;  /* library not found in this path */
-  if (luaL_loadfile(L, filename) != 0)
+  if (luaL_loadfile(L, filename) != LUA_OK)
     loaderror(L, filename);
     loaderror(L, filename);
   return 1;  /* library loaded successfully */
   return 1;  /* library loaded successfully */
 }
 }

+ 4 - 4
lstate.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstate.c,v 2.38 2006/08/15 19:59:20 roberto Exp roberto $
+** $Id: lstate.c,v 2.39 2006/09/11 14:07:24 roberto Exp roberto $
 ** Global State
 ** Global State
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -95,7 +95,7 @@ static void preinit_state (lua_State *L, global_State *g) {
   L->openupval = NULL;
   L->openupval = NULL;
   L->size_ci = 0;
   L->size_ci = 0;
   L->baseCcalls = 0;
   L->baseCcalls = 0;
-  L->status = 0;
+  L->status = LUA_OK;
   L->base_ci = L->ci = NULL;
   L->base_ci = L->ci = NULL;
   L->savedpc = NULL;
   L->savedpc = NULL;
   L->errfunc = 0;
   L->errfunc = 0;
@@ -189,7 +189,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
   g->gcstepmul = LUAI_GCMUL;
   g->gcstepmul = LUAI_GCMUL;
   g->gcdept = 0;
   g->gcdept = 0;
   for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
   for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
-  if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
+  if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
     /* memory allocation error: free partial state */
     /* memory allocation error: free partial state */
     close_state(L);
     close_state(L);
     L = NULL;
     L = NULL;
@@ -216,7 +216,7 @@ LUA_API void lua_close (lua_State *L) {
     L->ci = L->base_ci;
     L->ci = L->base_ci;
     L->base = L->top = L->ci->base;
     L->base = L->top = L->ci->base;
     G(L)->nCcalls = 0;
     G(L)->nCcalls = 0;
-  } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
+  } while (luaD_rawrunprotected(L, callallgcTM, NULL) != LUA_OK);
   lua_assert(G(L)->tmudata == NULL);
   lua_assert(G(L)->tmudata == NULL);
   luai_userstateclose(L);
   luai_userstateclose(L);
   close_state(L);
   close_state(L);

+ 4 - 4
ltests.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltests.c,v 2.38 2006/07/11 15:53:29 roberto Exp roberto $
+** $Id: ltests.c,v 2.39 2006/09/11 14:07:24 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -690,7 +690,7 @@ static int doonnewstack (lua_State *L) {
   size_t l;
   size_t l;
   const char *s = luaL_checklstring(L, 1, &l);
   const char *s = luaL_checklstring(L, 1, &l);
   int status = luaL_loadbuffer(L1, s, l, s);
   int status = luaL_loadbuffer(L1, s, l, s);
-  if (status == 0)
+  if (status == LUA_OK)
     status = lua_pcall(L1, 0, 0, 0);
     status = lua_pcall(L1, 0, 0, 0);
   lua_pushinteger(L, status);
   lua_pushinteger(L, status);
   return 1;
   return 1;
@@ -759,9 +759,9 @@ static int doremote (lua_State *L) {
   int status;
   int status;
   lua_settop(L1, 0);
   lua_settop(L1, 0);
   status = luaL_loadbuffer(L1, code, lcode, code);
   status = luaL_loadbuffer(L1, code, lcode, code);
-  if (status == 0)
+  if (status == LUA_OK)
     status = lua_pcall(L1, 0, LUA_MULTRET, 0);
     status = lua_pcall(L1, 0, LUA_MULTRET, 0);
-  if (status != 0) {
+  if (status != LUA_OK) {
     lua_pushnil(L);
     lua_pushnil(L);
     lua_pushinteger(L, status);
     lua_pushinteger(L, status);
     lua_pushstring(L, lua_tostring(L1, -1));
     lua_pushstring(L, lua_tostring(L1, -1));

+ 26 - 24
lua.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lua.c,v 1.162 2006/09/11 14:07:24 roberto Exp roberto $
+** $Id: lua.c,v 1.163 2006/09/18 14:03:18 roberto Exp roberto $
 ** Lua stand-alone interpreter
 ** Lua stand-alone interpreter
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -63,7 +63,7 @@ static void l_message (const char *pname, const char *msg) {
 
 
 
 
 static int report (lua_State *L, int status) {
 static int report (lua_State *L, int status) {
-  if (status && !lua_isnil(L, -1)) {
+  if (status != LUA_OK && !lua_isnil(L, -1)) {
     const char *msg = lua_tostring(L, -1);
     const char *msg = lua_tostring(L, -1);
     if (msg == NULL) msg = "(error object is not a string)";
     if (msg == NULL) msg = "(error object is not a string)";
     l_message(progname, msg);
     l_message(progname, msg);
@@ -101,7 +101,7 @@ static int docall (lua_State *L, int narg, int clear) {
   signal(SIGINT, SIG_DFL);
   signal(SIGINT, SIG_DFL);
   lua_remove(L, base);  /* remove traceback function */
   lua_remove(L, base);  /* remove traceback function */
   /* force a complete garbage collection in case of errors */
   /* force a complete garbage collection in case of errors */
-  if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0);
+  if (status != LUA_OK) lua_gc(L, LUA_GCCOLLECT, 0);
   return status;
   return status;
 }
 }
 
 
@@ -130,13 +130,15 @@ static int getargs (lua_State *L, char **argv, int n) {
 
 
 
 
 static int dofile (lua_State *L, const char *name) {
 static int dofile (lua_State *L, const char *name) {
-  int status = luaL_loadfile(L, name) || docall(L, 0, 1);
+  int status = luaL_loadfile(L, name);
+  if (status == LUA_OK) status = docall(L, 0, 1);
   return report(L, status);
   return report(L, status);
 }
 }
 
 
 
 
 static int dostring (lua_State *L, const char *s, const char *name) {
 static int dostring (lua_State *L, const char *s, const char *name) {
-  int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1);
+  int status = luaL_loadbuffer(L, s, strlen(s), name);
+  if (status == LUA_OK) status = docall(L, 0, 1);
   return report(L, status);
   return report(L, status);
 }
 }
 
 
@@ -218,12 +220,12 @@ static void dotty (lua_State *L) {
   const char *oldprogname = progname;
   const char *oldprogname = progname;
   progname = NULL;
   progname = NULL;
   while ((status = loadline(L)) != -1) {
   while ((status = loadline(L)) != -1) {
-    if (status == 0) status = docall(L, 0, 0);
+    if (status == LUA_OK) status = docall(L, 0, 0);
     report(L, status);
     report(L, status);
-    if (status == 0 && lua_gettop(L) > 0) {  /* any result to print? */
+    if (status == LUA_OK && lua_gettop(L) > 0) {  /* any result to print? */
       lua_getglobal(L, "print");
       lua_getglobal(L, "print");
       lua_insert(L, 1);
       lua_insert(L, 1);
-      if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0)
+      if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)
         l_message(progname, lua_pushfstring(L,
         l_message(progname, lua_pushfstring(L,
                                "error calling " LUA_QL("print") " (%s)",
                                "error calling " LUA_QL("print") " (%s)",
                                lua_tostring(L, -1)));
                                lua_tostring(L, -1)));
@@ -246,7 +248,7 @@ static int handle_script (lua_State *L, char **argv, int n) {
     fname = NULL;  /* stdin */
     fname = NULL;  /* stdin */
   status = luaL_loadfile(L, fname);
   status = luaL_loadfile(L, fname);
   lua_insert(L, -(narg+1));
   lua_insert(L, -(narg+1));
-  if (status == 0)
+  if (status == LUA_OK)
     status = docall(L, narg, 0);
     status = docall(L, narg, 0);
   else
   else
     lua_pop(L, narg);
     lua_pop(L, narg);
@@ -301,28 +303,28 @@ static int runargs (lua_State *L, char **argv, int n) {
         const char *chunk = argv[i] + 2;
         const char *chunk = argv[i] + 2;
         if (*chunk == '\0') chunk = argv[++i];
         if (*chunk == '\0') chunk = argv[++i];
         lua_assert(chunk != NULL);
         lua_assert(chunk != NULL);
-        if (dostring(L, chunk, "=(command line)") != 0)
-          return 1;
+        if (dostring(L, chunk, "=(command line)") != LUA_OK)
+          return 0;
         break;
         break;
       }
       }
       case 'l': {
       case 'l': {
         const char *filename = argv[i] + 2;
         const char *filename = argv[i] + 2;
         if (*filename == '\0') filename = argv[++i];
         if (*filename == '\0') filename = argv[++i];
         lua_assert(filename != NULL);
         lua_assert(filename != NULL);
-        if (dolibrary(L, filename))
-          return 1;  /* stop if file fails */
+        if (dolibrary(L, filename) != LUA_OK)
+          return 0;  /* stop if file fails */
         break;
         break;
       }
       }
       default: break;
       default: break;
     }
     }
   }
   }
-  return 0;
+  return 1;
 }
 }
 
 
 
 
 static int handle_luainit (lua_State *L) {
 static int handle_luainit (lua_State *L) {
   const char *init = getenv(LUA_INIT);
   const char *init = getenv(LUA_INIT);
-  if (init == NULL) return 0;  /* status OK */
+  if (init == NULL) return LUA_OK;
   else if (init[0] == '@')
   else if (init[0] == '@')
     return dofile(L, init+1);
     return dofile(L, init+1);
   else
   else
@@ -333,7 +335,7 @@ static int handle_luainit (lua_State *L) {
 struct Smain {
 struct Smain {
   int argc;
   int argc;
   char **argv;
   char **argv;
-  int status;
+  int ok;
 };
 };
 
 
 
 
@@ -347,20 +349,20 @@ static int pmain (lua_State *L) {
   lua_gc(L, LUA_GCSTOP, 0);  /* stop collector during initialization */
   lua_gc(L, LUA_GCSTOP, 0);  /* stop collector during initialization */
   luaL_openlibs(L);  /* open libraries */
   luaL_openlibs(L);  /* open libraries */
   lua_gc(L, LUA_GCRESTART, 0);
   lua_gc(L, LUA_GCRESTART, 0);
-  s->status = handle_luainit(L);
-  if (s->status != 0) return 0;
+  s->ok = (handle_luainit(L) == LUA_OK);
+  if (!s->ok) return 0;
   script = collectargs(argv, &has_i, &has_v, &has_e);
   script = collectargs(argv, &has_i, &has_v, &has_e);
   if (script < 0) {  /* invalid args? */
   if (script < 0) {  /* invalid args? */
     print_usage();
     print_usage();
-    s->status = 1;
+    s->ok = 0;
     return 0;
     return 0;
   }
   }
   if (has_v) print_version();
   if (has_v) print_version();
-  s->status = runargs(L, argv, (script > 0) ? script : s->argc);
-  if (s->status != 0) return 0;
+  s->ok = runargs(L, argv, (script > 0) ? script : s->argc);
+  if (!s->ok) return 0;
   if (script)
   if (script)
-    s->status = handle_script(L, argv, script);
-  if (s->status != 0) return 0;
+    s->ok = (handle_script(L, argv, script) == LUA_OK);
+  if (!s->ok) return 0;
   if (has_i)
   if (has_i)
     dotty(L);
     dotty(L);
   else if (script == 0 && !has_e && !has_v) {
   else if (script == 0 && !has_e && !has_v) {
@@ -387,6 +389,6 @@ int main (int argc, char **argv) {
   status = lua_cpcall(L, &pmain, &s);
   status = lua_cpcall(L, &pmain, &s);
   report(L, status);
   report(L, status);
   lua_close(L);
   lua_close(L);
-  return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (s.ok && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 }
 
 

+ 3 - 2
lua.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lua.h,v 1.219 2006/09/11 14:07:24 roberto Exp roberto $
+** $Id: lua.h,v 1.220 2006/09/18 14:03:18 roberto Exp roberto $
 ** Lua - An Extensible Extension Language
 ** Lua - An Extensible Extension Language
 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
 ** See Copyright Notice at the end of this file
 ** See Copyright Notice at the end of this file
@@ -39,7 +39,8 @@
 #define lua_upvalueindex(i)	(LUA_GLOBALSINDEX-(i))
 #define lua_upvalueindex(i)	(LUA_GLOBALSINDEX-(i))
 
 
 
 
-/* thread status; 0 is OK */
+/* thread status */
+#define LUA_OK		0
 #define LUA_YIELD	1
 #define LUA_YIELD	1
 #define LUA_ERRRUN	2
 #define LUA_ERRRUN	2
 #define LUA_ERRSYNTAX	3
 #define LUA_ERRSYNTAX	3