Skip to content

Commit

Permalink
Lua: Throw error on set_property if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jun 17, 2024
1 parent 64e8e8c commit eb6f0d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua-api/lib/src/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,19 @@ void set_property(sol::this_state s, uevr::API::UObject* self, const std::wstrin
const auto c = self->get_class();

if (c == nullptr) {
return;
throw sol::error("[set_property] Object has no class");
}

const auto desc = c->find_property(name.c_str());

if (desc == nullptr) {
return;
throw sol::error(std::format("[set_property] Property '{}' not found", utility::narrow(name)));
}

const auto propc = desc->get_class();

if (propc == nullptr) {
return;
throw sol::error(std::format("[set_property] Property '{}' has no class", utility::narrow(name)));
}

const auto name_hash = utility::hash(propc->get_fname()->to_string());
Expand Down

0 comments on commit eb6f0d7

Please sign in to comment.