Implement tabletype tagging

This commit is contained in:
2021-08-10 10:41:06 -04:00
parent 99d8ca718b
commit ee16970a8a
4 changed files with 92 additions and 36 deletions

View File

@@ -463,18 +463,6 @@ public:
lua_rawseti(L_, tab, key);
}
// template<typename VT>
// void rawset(LuaSlot tab, const char *field, VT value) const {
// push_any_value(value);
// lua_rawset(L_, tab, field);
// }
// template<typename RT>
// void rawget(RT &target, LuaSlot tab, const char *field) const {
// lua_rawget(L_, tab, field);
// pop_any_value(target);
// }
// Call invokes any C function. It pushes the arguments on the stack,
// calls the cfunction, verifies that the number of return values is as
// expected, and pops the return values into LuaVars.
@@ -482,6 +470,23 @@ public:
void call(T&... args) {
call_cfunction<0>(lua_gettop(L_), args...);
}
// Lua flagbits manipulation: Table types.
enum TableType {
TAB_GENERAL, // A general-purpose table.
TAB_REGISTRY, // The registry table.
TAB_GLOBALENV, // The global environment table.
TAB_TANGIBLE, // A tangible's database.
TAB_TANGIBLEMETA, // A tangible's metatable.
TAB_GLOBALDB, // Part of the globaldb.
TAB_CLASS, // A class which is directly reachable from the global environment.
};
TableType gettabletype(LuaSlot tab);
void settabletype(LuaSlot tab, TableType t);
// Lua flagbits manipulation: visited bit.
bool getvisited(LuaSlot tab);
void setvisited(LuaSlot tab, bool visited);
};