Reimplement the 'pairs' iterator and 'next' iterator

This commit is contained in:
2021-07-03 19:49:55 -04:00
parent 9eaeebb2da
commit be529afc55
4 changed files with 253 additions and 5 deletions

View File

@@ -151,6 +151,11 @@ void LuaStack::newtable(LuaSlot target) const {
lua_replace(L_, target);
}
void LuaStack::createtable(LuaSlot target, int narr, int nrec) const {
lua_createtable(L_, narr, nrec);
lua_replace(L_, target);
}
lua_State *LuaStack::newthread(LuaSlot target) const {
lua_State *result = lua_newthread(L_);
lua_replace(L_, target);
@@ -252,6 +257,10 @@ void LuaStack::cleartable(LuaSlot tab) const {
}
}
int LuaStack::rawlen(LuaSlot obj) const {
return lua_rawlen(L_, obj.index());
}
void LuaStack::check_nret(int xnret, int otop, int nret) const {
int ntop = lua_gettop(L_);
if ((nret != xnret)||(ntop != otop + xnret)) {