Remove action subtable, fix bug in makeclass

This commit is contained in:
2021-12-28 13:56:16 -05:00
parent 154ee737c6
commit 2e543984e6
7 changed files with 13 additions and 56 deletions

View File

@@ -273,22 +273,15 @@ void LuaStack::makeclass(LuaSlot classtab, LuaSlot classname) const {
// Get the classtab from the global environment.
LS.rawget(classtab, globtab, classname);
// Make sure we're not reusing a table that isn't a class.
if (LS.istable(classtab)) {
LS.rawget(cname, classtab, "__class");
} else {
LS.set(cname, LuaNil);
}
// Make a new table if necessary.
if (!LS.rawequal(cname, classname)) {
if (!LS.istable(classtab)) {
LS.newtable(classtab);
LS.rawset(globtab, classname, classtab);
LS.rawset(classtab, "__class", classname);
}
// Repair the special fields.
LS.settabletype(classtab, LUA_TT_CLASS);
LS.rawset(classtab, "__class", classname);
LS.rawset(classtab, "__index", classtab);
// Put the stack back.
@@ -353,17 +346,6 @@ void LuaStack::movesortablekey(LuaSlot key, LuaStack &otherstack, LuaSlot others
}
}
void LuaStack::makesubtable(LuaSlot sub, LuaSlot tab, const char *name) const {
assert(istable(tab));
rawget(sub, tab, name);
if (istable(sub)) {
return;
} else {
newtable(sub);
rawset(tab, name, sub);
}
}
void LuaStack::cleartable(LuaSlot tab, bool clearmeta) const {
assert(istable(tab));
lua_pushnil(L_);