Change the creation/deletion of tangibles so that the tangible database is never really deleted.

This commit is contained in:
2023-03-16 23:31:29 -04:00
parent 86a27ef2d4
commit a8c780563f
9 changed files with 152 additions and 90 deletions

View File

@@ -55,14 +55,11 @@ eng::string World::tangible_pprint(int64_t id) const {
LS.rawget(tan, tangibles, id);
eng::ostringstream oss;
if (LS.istable(tan)) {
LS.getmetatable(meta, tan);
LS.clearmetatable(tan);
PrettyPrintOptions opts;
opts.indent = false;
pprint(LS, tan, opts, &oss);
LS.setmetatable(tan, meta);
} else {
oss << "<no such tangible: " << id << ">";
oss << "<no such tangible " << id << ">{}";
}
LS.result();
return oss.str();
@@ -384,7 +381,7 @@ LuaDefine(unittests_world3diffluatab, "", "some unit tests") {
// The data in the master model should now look like this:
const char *expect_123 =
"{ "
"<tangible 123>{ "
"bacon='crispy', "
"inventory={ gold='wealthy' }, "
"skills={ "
@@ -393,7 +390,7 @@ LuaDefine(unittests_world3diffluatab, "", "some unit tests") {
"} "
"}";
const char *expect_345 =
"{ "
"<tangible 345>{ "
"inventory={ gold='poor' }, "
"phone='867-5309' "
"}";