diff --git a/luprex/core/cpp/luastack.cpp b/luprex/core/cpp/luastack.cpp index a59c3991..2071981b 100644 --- a/luprex/core/cpp/luastack.cpp +++ b/luprex/core/cpp/luastack.cpp @@ -154,7 +154,7 @@ void LuaStack::makeclass(LuaSlot classtab, LuaSlot classname) const { // Validate the class name. LS.checkstring(classname); - if (LS.equal(classname, "_G")) { + if (LS.rawequal(classname, "_G")) { luaL_error(L_, "_G is explicitly not allowed as a class name"); } diff --git a/luprex/core/cpp/luastack.hpp b/luprex/core/cpp/luastack.hpp index 3e048688..f4c4d380 100644 --- a/luprex/core/cpp/luastack.hpp +++ b/luprex/core/cpp/luastack.hpp @@ -403,13 +403,13 @@ public: lua_pop(L_, 1); } - bool equal(LuaSlot v1, LuaSlot v2) const { - return lua_compare(L_, v1, v2, LUA_OPEQ); + bool rawequal(LuaSlot v1, LuaSlot v2) const { + return lua_rawequal(L_, v1, v2); } - bool equal(LuaSlot v1, const char *name) const { + bool rawequal(LuaSlot v1, const char *name) const { push_any_value(name); - bool result = lua_compare(L_, v1, -1, LUA_OPEQ); + bool result = lua_rawequal(L_, v1, -1); lua_pop(L_, 1); return result; } diff --git a/luprex/core/cpp/table.cpp b/luprex/core/cpp/table.cpp index f08d3dc4..a1183180 100644 --- a/luprex/core/cpp/table.cpp +++ b/luprex/core/cpp/table.cpp @@ -12,7 +12,7 @@ LuaDefine(table_equal, "c") { while (lua_next(L, t1.index()) != 0) { lua_pushvalue(L, -2); // k v1 k lua_rawget(L, t2.index()); // k v1 v2 - if (!lua_equal(L, -1, -2)) { + if (!lua_rawequal(L, -1, -2)) { LS.set(eql, false); return LS.result(); } @@ -36,7 +36,7 @@ LuaDefine(table_findremove, "c") { while (true) { lua_pushinteger(L, src); lua_rawget(L, -3); - if (lua_equal(L, -1, -2)) { + if (lua_rawequal(L, -1, -2)) { src++; lua_pop(L, 1); } else if (lua_isnil(L, -1)) { @@ -68,7 +68,7 @@ LuaDefine(table_findremove, "c") { LuaDefine(table_push, "c") { luaL_checktype(L, -2, LUA_TTABLE); - int len = lua_objlen(L, -2); + int len = lua_rawlen(L, -2); lua_pushinteger(L, len+1); lua_pushvalue(L, -2); lua_rawset(L, -4); @@ -81,7 +81,7 @@ LuaDefine(table_find, "c") { for (int i = 1; ; i++) { lua_pushinteger(L, i); lua_rawget(L, -3); - if (lua_equal(L, -1, -2)) { + if (lua_rawequal(L, -1, -2)) { lua_pop(L, 3); lua_pushinteger(L, i); return 1;