diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-03-18 15:29:05 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-03-18 15:29:05 +0000 |
commit | ca3d1e1958ed89da5147eee42096baae35c744da (patch) | |
tree | d7d66a2cfa2cc16fd22cb50965cc2aca3437cd82 | |
parent | 9a1b7e5627a5b5e85ed5c50c18932a9808fd676a (diff) | |
download | prosody-ca3d1e1958ed89da5147eee42096baae35c744da.tar.gz prosody-ca3d1e1958ed89da5147eee42096baae35c744da.zip |
util.table: Compatibility with Lua 5.1 lua_equals
-rw-r--r-- | util-src/table.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util-src/table.c b/util-src/table.c index 0756a256..4bbceedb 100644 --- a/util-src/table.c +++ b/util-src/table.c @@ -6,6 +6,10 @@ #define LUA_MAXINTEGER PTRDIFF_MAX #endif +#if (LUA_VERSION_NUM > 501) +#define lua_equal(L, A, B) lua_compare(L, A, B, LUA_OPEQ) +#endif + static int Lcreate_table(lua_State *L) { lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)); return 1; @@ -43,7 +47,7 @@ static int Lmove (lua_State *L) { n = e - f + 1; /* number of elements to move */ luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4, "destination wrap around"); - if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) { + if (t > e || t <= f || (tt != 1 && !lua_equal(L, 1, tt))) { for (i = 0; i < n; i++) { lua_rawgeti(L, 1, f + i); lua_rawseti(L, tt, t + i); |