Move some of the difference-transmission unit tests from lua to C++

This commit is contained in:
2026-02-25 01:48:23 -05:00
parent 829537a8d6
commit adead5149e
7 changed files with 311 additions and 310 deletions

View File

@@ -66,19 +66,22 @@ lua_State *LuaCoreStack::newstate (lua_Alloc allocf) {
assert(L != nullptr);
lua_atpanic(L, &panicf);
// We want all states to have a classes table and
// a tangibles table so that LS.makeclass and LS.maketan
// work out-of-the-box.
// We want all states to have a classes table, a tangibles table,
// and persist/unpersist tables so that LS.makeclass, LS.maketan,
// and eris work out-of-the-box.
LuaVar globtab;
LuaExtStack LS(L, globtab);
LS.rawset(LuaRegistry, "classes", LuaNewTable);
LS.rawset(LuaRegistry, "classnames", LuaNewTable);
LS.rawset(LuaRegistry, "tangibles", LuaNewTable);
LS.rawset(LuaRegistry, "persist", LuaNewTable);
LS.rawset(LuaRegistry, "unpersist", LuaNewTable);
// Tag the registry and global environment with their tabletypes.
LS.settabletype(LuaRegistry, LUA_TT_REGISTRY);
LS.getglobaltable(globtab);
LS.settabletype(globtab, LUA_TT_GLOBALENV);
lua_pushstring(L, "classes");
lua_newtable(L);
lua_rawset(L, LUA_REGISTRYINDEX);
lua_pushstring(L, "classnames");
lua_newtable(L);
lua_rawset(L, LUA_REGISTRYINDEX);
lua_pushstring(L, "tangibles");
lua_newtable(L);
lua_rawset(L, LUA_REGISTRYINDEX);
return L;
}