# HG changeset patch # User Matthew Wild # Date 1647617345 0 # Node ID 308ed64dc69b92e020142c8ed9a40bb8b052abfb # Parent 082f38e9de646337807f319facea6f9754115811 util.table: Compatibility with Lua 5.1 lua_equals diff -r 082f38e9de64 -r 308ed64dc69b util-src/table.c --- a/util-src/table.c Fri Mar 18 15:24:12 2022 +0000 +++ b/util-src/table.c Fri Mar 18 15:29:05 2022 +0000 @@ -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 @@ 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);