Removed some more LuaOldStack
This commit is contained in:
@@ -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 << "<no such tangible " << id << ">{}";
|
||||
}
|
||||
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<eng::string> 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<std::pair<eng::string, eng::string>> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user