aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Janda <siffiejoe@gmx.net>2017-09-14 00:27:15 +0200
committerPhilipp Janda <siffiejoe@gmx.net>2017-09-14 00:27:15 +0200
commitf3b11608b9c54b83e54aba2cac8de07043a9849d (patch)
tree6af8ab08b01f3873f6f10b5c1ea628f8d69c540c
parent6f3deeaa6a4743e1f5148c613addb3f94a22d2df (diff)
parent7320d58358de2d981135e7d8ef03eaed665bb2bc (diff)
downloadlua-compat-5.3-f3b11608b9c54b83e54aba2cac8de07043a9849d.tar.gz
lua-compat-5.3-f3b11608b9c54b83e54aba2cac8de07043a9849d.tar.bz2
lua-compat-5.3-f3b11608b9c54b83e54aba2cac8de07043a9849d.zip
Merge branch 'ThePhD-feature/LUA_ERRGCMM'
-rw-r--r--README.md2
-rw-r--r--c-api/compat-5.3.c2
-rw-r--r--c-api/compat-5.3.h16
3 files changed, 19 insertions, 1 deletions
diff --git a/README.md b/README.md
index 08614a1..eaaf6ee 100644
--- a/README.md
+++ b/README.md
@@ -133,6 +133,7 @@ For Lua 5.1 additionally:
133* `lua_isinteger` 133* `lua_isinteger`
134* `lua_numbertointeger` 134* `lua_numbertointeger`
135* `lua_callk` and `lua_pcallk` (limited compatibility, see [here][14]) 135* `lua_callk` and `lua_pcallk` (limited compatibility, see [here][14])
136* `lua_resume`
136* `lua_rawget` and `lua_rawgeti` (return values) 137* `lua_rawget` and `lua_rawgeti` (return values)
137* `lua_rawgetp` and `lua_rawsetp` 138* `lua_rawgetp` and `lua_rawsetp`
138* `luaL_requiref` (now checks `package.loaded` first) 139* `luaL_requiref` (now checks `package.loaded` first)
@@ -141,6 +142,7 @@ For Lua 5.1 additionally:
141 142
142For Lua 5.1 additionally: 143For Lua 5.1 additionally:
143* `LUA_OK` 144* `LUA_OK`
145* `LUA_ERRGCMM`
144* `LUA_OP*` macros for `lua_arith` and `lua_compare` 146* `LUA_OP*` macros for `lua_arith` and `lua_compare`
145* `lua_Unsigned` 147* `lua_Unsigned`
146* `lua_absindex` 148* `lua_absindex`
diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c
index 883efb8..fab89c0 100644
--- a/c-api/compat-5.3.c
+++ b/c-api/compat-5.3.c
@@ -110,7 +110,7 @@ COMPAT53_API void lua_len (lua_State *L, int i) {
110 case LUA_TUSERDATA: 110 case LUA_TUSERDATA:
111 if (luaL_callmeta(L, i, "__len")) 111 if (luaL_callmeta(L, i, "__len"))
112 break; 112 break;
113 /* maybe fall through */ 113 /* FALLTHROUGH */
114 default: 114 default:
115 luaL_error(L, "attempt to get length of a %s value", 115 luaL_error(L, "attempt to get length of a %s value",
116 lua_typename(L, lua_type(L, i))); 116 lua_typename(L, lua_type(L, i)));
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h
index bee77a1..6c76930 100644
--- a/c-api/compat-5.3.h
+++ b/c-api/compat-5.3.h
@@ -88,6 +88,19 @@ extern "C" {
88# define LUA_OPLE 2 88# define LUA_OPLE 2
89#endif 89#endif
90 90
91/* LuaJIT/Lua 5.1 does not have the updated
92 * error codes for thread status/function returns (but some patched versions do)
93 * define it only if it's not found
94 */
95#if !defined(LUA_ERRGCMM)
96/* Use + 2 because in some versions of Lua (Lua 5.1)
97 * LUA_ERRFILE is defined as (LUA_ERRERR+1)
98 * so we need to avoid it (LuaJIT might have something at this
99 * integer value too)
100 */
101# define LUA_ERRGCMM (LUA_ERRERR + 2)
102#endif /* LUA_ERRGCMM define */
103
91typedef size_t lua_Unsigned; 104typedef size_t lua_Unsigned;
92 105
93typedef struct luaL_Buffer_53 { 106typedef struct luaL_Buffer_53 {
@@ -186,6 +199,9 @@ COMPAT53_API int luaL_execresult (lua_State *L, int stat);
186#define lua_pcallk(L, na, nr, err, ctx, cont) \ 199#define lua_pcallk(L, na, nr, err, ctx, cont) \
187 ((void)(ctx), (void)(cont), lua_pcall((L), (na), (nr), (err))) 200 ((void)(ctx), (void)(cont), lua_pcall((L), (na), (nr), (err)))
188 201
202#define lua_resume(L, from, nargs) \
203 ((void)(from), lua_resume((L), (nargs)))
204
189#define luaL_buffinit COMPAT53_CONCAT(COMPAT53_PREFIX, _buffinit_53) 205#define luaL_buffinit COMPAT53_CONCAT(COMPAT53_PREFIX, _buffinit_53)
190COMPAT53_API void luaL_buffinit (lua_State *L, luaL_Buffer_53 *B); 206COMPAT53_API void luaL_buffinit (lua_State *L, luaL_Buffer_53 *B);
191 207