From 167dfe909f9b33368d079bc9ae8ab5a585cfc21d Mon Sep 17 00:00:00 2001 From: jyelon Date: Fri, 14 Apr 2023 15:13:59 -0400 Subject: [PATCH] Removed some more LuaOldStack --- luprex/cpp/core/world-core.cpp | 2 +- luprex/cpp/core/world-testing.cpp | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/luprex/cpp/core/world-core.cpp b/luprex/cpp/core/world-core.cpp index 17a539c4..5ac1350a 100644 --- a/luprex/cpp/core/world-core.cpp +++ b/luprex/cpp/core/world-core.cpp @@ -386,7 +386,7 @@ void World::rebuild_sourcedb() { lthread_prints_.reset(); close_lthread_state(); if (!err.empty() || !prints.empty()) { - util::dprint("Loading Module ", mod,":"); + util::dprint("Loading Module ", mod); if (!err.empty()) util::dprint(err); if (!prints.empty()) util::dprint(prints); } diff --git a/luprex/cpp/core/world-testing.cpp b/luprex/cpp/core/world-testing.cpp index 3587a557..de160842 100644 --- a/luprex/cpp/core/world-testing.cpp +++ b/luprex/cpp/core/world-testing.cpp @@ -51,7 +51,7 @@ eng::string World::tangibles_near_debug_string(int64_t actor, int64_t distance) eng::string World::tangible_pprint(int64_t id) const { lua_State *L = state(); LuaVar tangibles, tan, meta; - LuaOldStack LS(L, tangibles, tan, meta); + LuaExtStack LS(L, tangibles, tan, meta); LS.rawget(tangibles, LuaRegistry, "tangibles"); LS.rawget(tan, tangibles, id); eng::ostringstream oss; @@ -62,14 +62,13 @@ eng::string World::tangible_pprint(int64_t id) const { } else { oss << "{}"; } - LS.result(); return oss.str(); } eng::string World::numbered_tables_debug_string() const { lua_State *L = state(); LuaVar ntmap, tab, tid; - LuaOldStack LS(L, ntmap, tab, tid); + LuaExtStack LS(L, ntmap, tab, tid); eng::vector result; eng::ostringstream oss; @@ -88,7 +87,6 @@ eng::string World::numbered_tables_debug_string() const { result.push_back("unknown"); } } - LS.result(); std::sort(result.begin(), result.end()); for (const eng::string &s : result) { oss << s << ";"; @@ -99,8 +97,8 @@ eng::string World::numbered_tables_debug_string() const { eng::string World::paired_tables_debug_string(lua_State *master) const { lua_State *synch = state(); LuaVar mntmap, sntmap, mtab, stab, mtid, stid; - LuaOldStack MLS(master, mntmap, mtab, mtid); - LuaOldStack SLS(synch, sntmap, stab, stid); + LuaExtStack MLS(master, mntmap, mtab, mtid); + LuaExtStack SLS(synch, sntmap, stab, stid); eng::vector> result; eng::ostringstream oss; @@ -128,8 +126,6 @@ eng::string World::paired_tables_debug_string(lua_State *master) const { result.push_back(std::make_pair(mname, sname)); } } - MLS.result(); - SLS.result(); std::sort(result.begin(), result.end()); for (const auto &pair : result) { oss << pair.first << "=" << pair.second << ";"; @@ -140,7 +136,7 @@ eng::string World::paired_tables_debug_string(lua_State *master) const { void World::tangible_set_string(int64_t id, const eng::string &path, const eng::string &value) { lua_State *L = state(); LuaVar tangibles, tab, subtab; - LuaOldStack LS(L, tangibles, tab, subtab); + LuaExtStack LS(L, tangibles, tab, subtab); // Fetch the lua side of the tangible. LS.rawget(tangibles, LuaRegistry, "tangibles"); @@ -166,14 +162,12 @@ void World::tangible_set_string(int64_t id, const eng::string &path, const eng:: // Set the string value. LS.rawset(tab, finalpart, value); - LS.result(); - assert(stack_is_clear()); } void World::tangible_copy_global(int64_t id, const eng::string &path, const eng::string &global) { lua_State *L = state(); LuaVar tangibles, tab, subtab, globtab, value; - LuaOldStack LS(L, tangibles, tab, subtab, globtab, value); + LuaExtStack LS(L, tangibles, tab, subtab, globtab, value); // Fetch the lua side of the tangible. LS.rawget(tangibles, LuaRegistry, "tangibles"); @@ -201,12 +195,11 @@ void World::tangible_copy_global(int64_t id, const eng::string &path, const eng: LS.getglobaltable(globtab); LS.rawget(value, globtab, global); LS.rawset(tab, finalpart, value); - LS.result(); } void World::tangible_set_class(int64_t id, const eng::string &c) const { LuaVar tangibles, tan, meta, sclass; - LuaOldStack LS(state(), tangibles, tan, meta, sclass); + LuaExtStack LS(state(), tangibles, tan, meta, sclass); LS.rawget(tangibles, LuaRegistry, "tangibles"); LS.rawget(tan, tangibles, id); assert(LS.istable(tan)); @@ -217,7 +210,6 @@ void World::tangible_set_class(int64_t id, const eng::string &c) const { LS.makeclass(sclass, c); } LS.rawset(meta, "__index", sclass); - LS.result(); } void World::set_global_json(const eng::string &gvar, const eng::string &json) { @@ -248,14 +240,13 @@ eng::string World::get_global_json(const eng::string &gvar) { eng::string World::tangible_get_class(int64_t id) const { LuaVar tangibles, tan, meta, sclass; - LuaOldStack LS(state(), tangibles, tan, meta, sclass); + LuaExtStack LS(state(), tangibles, tan, meta, sclass); LS.rawget(tangibles, LuaRegistry, "tangibles"); LS.rawget(tan, tangibles, id); assert(LS.istable(tan)); LS.getmetatable(meta, tan); LS.rawget(sclass, meta, "__index"); eng::string result = LS.classname(sclass); - LS.result(); return result; }