Change how class tables are created and recreated for greater robustness

This commit is contained in:
2023-03-17 13:31:10 -04:00
parent a8c780563f
commit 5ede3f507c
4 changed files with 71 additions and 46 deletions

View File

@@ -60,9 +60,6 @@ World::World(WorldType wt) {
LS.getglobaltable(globtab);
LS.settabletype(globtab, LUA_TT_GLOBALENV);
// Create the tangibles table in the registry.
LS.rawset(LuaRegistry, "tangibles", LuaNewTable);
// Store the world type in the registry.
LS.rawset(LuaRegistry, "worldtype", wt);
@@ -592,7 +589,7 @@ void World::invoke_flush_prints(int64_t actor_id, int64_t place_id, const eng::s
void World::invoke_lua(int64_t actor_id, int64_t place_id, const eng::string &action, const InvocationData &data) {
assert(stack_is_clear());
// Make sure that actor and place exist.
// Make sure that actor and place exist and are not stubs.
Tangible *tactor = tangible_get(actor_id);
Tangible *tplace = tangible_get(place_id);
if ((tactor == nullptr) || (tplace == nullptr)) {