Added two new stack disciplines to LuaStack

This commit is contained in:
2023-04-06 20:12:03 -04:00
parent b8df2bbc89
commit 7f000bc0fd
26 changed files with 401 additions and 271 deletions

View File

@@ -50,7 +50,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;
LuaStack LS(L, tangibles, tan, meta);
LuaOldStack LS(L, tangibles, tan, meta);
LS.rawget(tangibles, LuaRegistry, "tangibles");
LS.rawget(tan, tangibles, id);
eng::ostringstream oss;
@@ -68,7 +68,7 @@ eng::string World::tangible_pprint(int64_t id) const {
eng::string World::numbered_tables_debug_string() const {
lua_State *L = state();
LuaVar ntmap, tab, tid;
LuaStack LS(L, ntmap, tab, tid);
LuaOldStack LS(L, ntmap, tab, tid);
eng::vector<eng::string> result;
eng::ostringstream oss;
@@ -98,8 +98,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;
LuaStack MLS(master, mntmap, mtab, mtid);
LuaStack SLS(synch, sntmap, stab, stid);
LuaOldStack MLS(master, mntmap, mtab, mtid);
LuaOldStack SLS(synch, sntmap, stab, stid);
eng::vector<std::pair<eng::string, eng::string>> result;
eng::ostringstream oss;
@@ -139,7 +139,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;
LuaStack LS(L, tangibles, tab, subtab);
LuaOldStack LS(L, tangibles, tab, subtab);
// Fetch the lua side of the tangible.
LS.rawget(tangibles, LuaRegistry, "tangibles");
@@ -172,7 +172,7 @@ void World::tangible_set_string(int64_t id, const eng::string &path, const eng::
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;
LuaStack LS(L, tangibles, tab, subtab, globtab, value);
LuaOldStack LS(L, tangibles, tab, subtab, globtab, value);
// Fetch the lua side of the tangible.
LS.rawget(tangibles, LuaRegistry, "tangibles");
@@ -205,7 +205,7 @@ void World::tangible_copy_global(int64_t id, const eng::string &path, const eng:
void World::tangible_set_class(int64_t id, const eng::string &c) const {
LuaVar tangibles, tan, meta, sclass;
LuaStack LS(state(), tangibles, tan, meta, sclass);
LuaOldStack LS(state(), tangibles, tan, meta, sclass);
LS.rawget(tangibles, LuaRegistry, "tangibles");
LS.rawget(tan, tangibles, id);
assert(LS.istable(tan));
@@ -221,7 +221,7 @@ void World::tangible_set_class(int64_t id, const eng::string &c) const {
eng::string World::tangible_get_class(int64_t id) const {
LuaVar tangibles, tan, meta, sclass;
LuaStack LS(state(), tangibles, tan, meta, sclass);
LuaOldStack LS(state(), tangibles, tan, meta, sclass);
LS.rawget(tangibles, LuaRegistry, "tangibles");
LS.rawget(tan, tangibles, id);
assert(LS.istable(tan));