Skip to content

Commit

Permalink
fix(lua): fix ents.UniversalMemberReference:GetPath not returning cor…
Browse files Browse the repository at this point in the history
…rect path in some cases
  • Loading branch information
Silverlan committed Feb 6, 2023
1 parent debabe0 commit 6bc89ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/shared/src/lua/lentity_components.cpp
Expand Up @@ -253,11 +253,12 @@ void Game::RegisterLuaEntityComponents(luabind::module_ &entsMod)
});
classDefMemRef.def(
"GetPath", +[](Game &game, const pragma::EntityUComponentMemberRef &ref) -> std::optional<std::string> {
auto *componentName = ref.GetComponentName();
auto *c = ref.GetComponent(game);
auto *cInfo = c ? c->GetComponentInfo() : nullptr;
auto &memberName = ref.GetMemberName();
if(!componentName || memberName.empty())
if(!cInfo || memberName.empty())
return {};
std::string name = "pragma:game/entity/ec/" + *componentName + "/" + memberName;
std::string name = "pragma:game/entity/ec/" + cInfo->name + "/" + memberName;
auto uuid = ref.GetUuid();
if(uuid.has_value())
name += "?entity_uuid=" + util::uuid_to_string(*uuid);
Expand Down

0 comments on commit 6bc89ff

Please sign in to comment.