diff --git a/src/game.cpp b/src/game.cpp index f640c95..9446586 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -801,6 +801,11 @@ std::string Game::backupLuaTable(const sol::table table, const std::string &pare k = std::to_string(key.as()); } + if (!parent.empty()) + { + k = "[\"" + k + "\"]"; + } + if (k != "_entry_node" && k != "_VERSION" && k.substr(0, 4) != "sol." && @@ -829,7 +834,12 @@ std::string Game::backupLuaTable(const sol::table table, const std::string &pare result += parent + k + " = \"" + v + "\"\n"; break; case sol::type::number: + if (value.is()) + { + v = std::to_string(value.as()); + }else{ v = std::to_string(value.as()); + } result += parent + k + " = " + v + "\n"; break; case sol::type::boolean: @@ -847,7 +857,7 @@ std::string Game::backupLuaTable(const sol::table table, const std::string &pare break; case sol::type::table: result += parent + k + " = {}\n"; - result += backupLuaTable(value.as(), parent + k + "."); + result += backupLuaTable(value.as(), parent + k); break; } } diff --git a/src/spine_object.cpp b/src/spine_object.cpp index 11ffa2e..4dc6e20 100644 --- a/src/spine_object.cpp +++ b/src/spine_object.cpp @@ -103,11 +103,12 @@ std::optional SpineObject::getPoint(const std::string &point_name) c spPointAttachment *point = SUB_CAST(spPointAttachment, att); float x = 0; float y = 0; - if (point) + if (point && point->super.type == SP_ATTACHMENT_POINT) { spPointAttachment_computeWorldPosition(point, slot->bone, &x, &y); + return jngl::Vec2(x, y); } - return jngl::Vec2(x, y); + return std::nullopt; } std::vector SpineObject::getPointNames() const