From b7e177924ea64fea8ec13f77a0ed814c92e2c8f9 Mon Sep 17 00:00:00 2001 From: UE4SS Date: Mon, 16 Oct 2023 00:09:14 +0200 Subject: [PATCH] Out-params for script hooks via Lua can now be set --- UE4SS/src/Mod/LuaMod.cpp | 10 +++++++++- assets/Changelog.md | 1 + deps/first/Unreal | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/UE4SS/src/Mod/LuaMod.cpp b/UE4SS/src/Mod/LuaMod.cpp index 0b49b6f12..ab79e1a6e 100644 --- a/UE4SS/src/Mod/LuaMod.cpp +++ b/UE4SS/src/Mod/LuaMod.cpp @@ -3398,7 +3398,15 @@ No overload found for function 'FPackageName:IsValidLongPackageName'. if (auto it = LuaType::StaticState::m_property_value_pushers.find(param_type_comparison_index); it != LuaType::StaticState::m_property_value_pushers.end()) { - auto data = param->ContainerPtrToValuePtr(Stack.Locals()); + void* data{}; + if (param->HasAnyPropertyFlags(Unreal::EPropertyFlags::CPF_OutParm)) + { + data = Unreal::FindOutParamValueAddress(Stack, param); + } + else + { + data = param->ContainerPtrToValuePtr(Stack.Locals()); + } const LuaType::PusherParams pusher_param{ .operation = LuaType::Operation::GetParam, .lua = lua, diff --git a/assets/Changelog.md b/assets/Changelog.md index aaa197751..42cd6cb74 100644 --- a/assets/Changelog.md +++ b/assets/Changelog.md @@ -23,6 +23,7 @@ Added an optional third parameter to `RegisterHook` If provided, it will act as a post callback hook where out-params can be modified Note that for BP-only functions, both callbacks act as post callbacks +Out-params for script hooks (`RegisterCustomEvent` or `RegisterHook` on a BP-only UFunction) can now be set by doing `Param:set()` ### C++ API Finalize C++ API. - LocalCC; Truman diff --git a/deps/first/Unreal b/deps/first/Unreal index ff73e6edb..2189a4774 160000 --- a/deps/first/Unreal +++ b/deps/first/Unreal @@ -1 +1 @@ -Subproject commit ff73e6edb1ae556f8dd048fed22438293cf48bf3 +Subproject commit 2189a4774e1a2a17377cd4592ec36926a1120934