More work on console I/O and minor fixes

This commit is contained in:
2021-10-25 14:47:37 -04:00
parent b5d62d3991
commit 9a02f408b0
13 changed files with 122 additions and 78 deletions

View File

@@ -315,7 +315,7 @@ void LuaStack::makesubtable(LuaSlot sub, LuaSlot tab, const char *name) const {
}
}
void LuaStack::cleartable(LuaSlot tab) const {
void LuaStack::cleartable(LuaSlot tab, bool clearmeta) const {
checktable(tab);
lua_pushnil(L_);
while (lua_next(L_, tab.index()) != 0) {
@@ -324,6 +324,10 @@ void LuaStack::cleartable(LuaSlot tab) const {
lua_pushnil(L_); // Push the new value.
lua_rawset(L_, tab.index());
}
if (clearmeta) {
lua_pushnil(L_);
lua_setmetatable(L_, tab.index());
}
}
int LuaStack::rawlen(LuaSlot obj) const {