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

@@ -392,11 +392,14 @@ public:
void checknometa(LuaSlot index) const;
void newtable(LuaSlot target) const;
void createtable(LuaSlot target, int narr, int nrec) const;
lua_State *newthread(LuaSlot target) const;
void getglobaltable(LuaSlot gltab) const;
void makesubtable(LuaSlot sub, LuaSlot tab, const char *name) const;
void cleartable(LuaSlot tab) const;
int rawlen(LuaSlot val) const;
int next(LuaSlot tab, LuaSlot key, LuaSlot value) const;
void makeclass(LuaSlot tab, LuaSlot name) const;
@@ -440,6 +443,12 @@ public:
pop_any_value(target);
}
template<typename RT>
void rawgeti(RT &target, LuaSlot tab, lua_Integer key) const {
lua_rawgeti(L_, tab, key);
pop_any_value(target);
}
template<typename KT, typename VT>
void rawset(LuaSlot tab, KT key, VT value) const {
push_any_value(key);
@@ -447,6 +456,12 @@ public:
lua_rawset(L_, tab);
}
template<typename VT>
void rawseti(LuaSlot tab, lua_Integer key, VT value) const {
push_any_value(value);
lua_rawseti(L_, tab, key);
}
// template<typename VT>
// void rawset(LuaSlot tab, const char *field, VT value) const {
// push_any_value(value);