Diff

util-src/table.c @ 12575:1f6f05a98fcd

util-src: Remove Lua 5.1 compat macros Part of #1600
author Kim Alvefur <zash@zash.se>
date Fri, 01 Jul 2022 21:21:21 +0200
parent 12405:308ed64dc69b
child 12591:494577d883ff
line wrap: on
line diff
--- a/util-src/table.c	Sat Jul 02 17:30:06 2022 +0200
+++ b/util-src/table.c	Fri Jul 01 21:21:21 2022 +0200
@@ -6,10 +6,6 @@
 #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;
@@ -47,7 +43,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_equal(L, 1, tt))) {
+		if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) {
 			for (i = 0; i < n; i++) {
 				lua_rawgeti(L, 1, f + i);
 				lua_rawseti(L, tt, t + i);
@@ -65,9 +61,7 @@
 }
 
 int luaopen_util_table(lua_State *L) {
-#if (LUA_VERSION_NUM > 501)
 	luaL_checkversion(L);
-#endif
 	lua_createtable(L, 0, 2);
 	lua_pushcfunction(L, Lcreate_table);
 	lua_setfield(L, -2, "create");