From eb6f0d7ddd9a9b1734686c98e467989368df8f9f Mon Sep 17 00:00:00 2001 From: praydog Date: Mon, 17 Jun 2024 13:57:43 -0700 Subject: [PATCH] Lua: Throw error on set_property if it doesn't exist --- lua-api/lib/src/ScriptContext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua-api/lib/src/ScriptContext.cpp b/lua-api/lib/src/ScriptContext.cpp index 88ca0d42..de631046 100644 --- a/lua-api/lib/src/ScriptContext.cpp +++ b/lua-api/lib/src/ScriptContext.cpp @@ -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());