fix error handling from SetErrorMessageFromResult

This commit is contained in:
Lion Kortlepel
2026-04-16 18:32:54 +02:00
parent e260de55af
commit 66f5f2b8b6
2 changed files with 16 additions and 4 deletions
+7 -2
View File
@@ -550,8 +550,13 @@ sol::table TLuaEngine::StateThreadData::Lua_TriggerLocalEvent(const std::string&
Result.set(i, FnRet);
++i;
} else {
auto ErrStr = FnRet.get<std::optional<std::string>>();
beammp_lua_error(std::string("TriggerLocalEvent: ") + (ErrStr ? *ErrStr : "(unknown error; error object is not a string)"));
std::string ErrStr;
if (FnRet.get_type() == sol::type::string) {
ErrStr = FnRet.get<sol::error>().what();
} else {
ErrStr = "(unknown error; error object is not inspectable)";
}
beammp_lua_errorf("TriggerLocalEvent: {}", ErrStr);
}
}
}