From 7320d58358de2d981135e7d8ef03eaed665bb2bc Mon Sep 17 00:00:00 2001 From: ThePhD Date: Wed, 13 Sep 2017 00:44:25 -0400 Subject: define LUA_ERRGCMM code for return values --- README.md | 1 + c-api/compat-5.3.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index d80405c..eaaf6ee 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ For Lua 5.1 additionally: For Lua 5.1 additionally: * `LUA_OK` +* `LUA_ERRGCMM` * `LUA_OP*` macros for `lua_arith` and `lua_compare` * `lua_Unsigned` * `lua_absindex` diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 3d20d21..6c76930 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h @@ -88,6 +88,19 @@ extern "C" { # define LUA_OPLE 2 #endif +/* LuaJIT/Lua 5.1 does not have the updated + * error codes for thread status/function returns (but some patched versions do) + * define it only if it's not found + */ +#if !defined(LUA_ERRGCMM) +/* Use + 2 because in some versions of Lua (Lua 5.1) + * LUA_ERRFILE is defined as (LUA_ERRERR+1) + * so we need to avoid it (LuaJIT might have something at this + * integer value too) + */ +# define LUA_ERRGCMM (LUA_ERRERR + 2) +#endif /* LUA_ERRGCMM define */ + typedef size_t lua_Unsigned; typedef struct luaL_Buffer_53 { -- cgit v1.2.3-55-g6feb