Still porting to lua 5.2

This commit is contained in:
2021-02-28 14:45:09 -05:00
parent 23ae577fbb
commit 5760078208
3 changed files with 9 additions and 9 deletions

View File

@@ -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");
}

View File

@@ -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;
}

View File

@@ -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;