From ff4c8ff99247af2497f356dba60b33667d9937cd Mon Sep 17 00:00:00 2001 From: praydog Date: Tue, 22 Oct 2024 21:01:55 -0700 Subject: [PATCH] Lua: Fix UClass object lookup functions not taking a bool as third arg --- lua-api/lib/src/ScriptContext.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua-api/lib/src/ScriptContext.cpp b/lua-api/lib/src/ScriptContext.cpp index 42cfbc0d..7a811a53 100644 --- a/lua-api/lib/src/ScriptContext.cpp +++ b/lua-api/lib/src/ScriptContext.cpp @@ -686,9 +686,10 @@ int ScriptContext::setup_bindings() { return sol::make_object(s, obj); // So it goes through sol_lua_push for our pooling mechanism }, - "get_objects_matching", [](sol::this_state s, uevr::API::UClass& self, sol::function fn) -> sol::object { + "get_objects_matching", [](sol::this_state s, uevr::API::UClass& self, sol::object allow_default_obj) -> sol::object { + const bool allow_default = allow_default_obj.is() ? allow_default_obj.as() : false; auto tbl = sol::state_view{s}.create_table(); - auto objects = self.get_objects_matching(); + auto objects = self.get_objects_matching(allow_default); for (auto obj : objects) { tbl.add(sol::make_object(s, obj)); @@ -696,8 +697,9 @@ int ScriptContext::setup_bindings() { return sol::make_object(s, tbl); }, - "get_first_object_matching", [](sol::this_state s, uevr::API::UClass& self) -> sol::object { - auto object = self.get_first_object_matching(); + "get_first_object_matching", [](sol::this_state s, uevr::API::UClass& self, sol::object allow_default_obj) -> sol::object { + const bool allow_default = allow_default_obj.is() ? allow_default_obj.as() : false; + auto object = self.get_first_object_matching(allow_default); if (object == nullptr) { return sol::make_object(s, sol::nil);