From f2a20c0231258a00a3faccdad9b3d0deed05dd1f Mon Sep 17 00:00:00 2001 From: jyelon Date: Tue, 21 Dec 2021 13:00:11 -0500 Subject: [PATCH] Add donotpredict to global(x) --- luprex/core/cpp/globaldb.cpp | 2 +- luprex/core/cpp/world-core.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/luprex/core/cpp/globaldb.cpp b/luprex/core/cpp/globaldb.cpp index e1015316..0fbde031 100644 --- a/luprex/core/cpp/globaldb.cpp +++ b/luprex/core/cpp/globaldb.cpp @@ -11,7 +11,7 @@ LuaDefine(global, "globalname", "get a table where global data can be stored") { // Get a pointer to the globaldb. LS.rawget(globaldb, LuaRegistry, "globaldb"); if (!LS.istable(globaldb)) { - luaL_error(L, "globaldb is not enabled"); + return lua_yield(L, 0); // donotpredict } LS.checkstring(globalname); diff --git a/luprex/core/cpp/world-core.cpp b/luprex/core/cpp/world-core.cpp index f120f954..14258dc9 100644 --- a/luprex/core/cpp/world-core.cpp +++ b/luprex/core/cpp/world-core.cpp @@ -62,7 +62,9 @@ World::World(util::WorldType wt) { LS.rawset(LuaRegistry, "tangibles", LuaNewTable); // Create the globaldb in the registry. - LS.rawset(LuaRegistry, "globaldb", LuaNewTable); + if (util::world_type_authoritative(wt)) { + LS.rawset(LuaRegistry, "globaldb", LuaNewTable); + } // Initialize the SourceDB. At this stage, the sourcedb is // empty, so it's just populating the lua builtins.