Skip to content

Commit

Permalink
Out-params for script hooks via Lua can now be set
Browse files Browse the repository at this point in the history
  • Loading branch information
UE4SS committed Oct 15, 2023
1 parent 5465e13 commit b7e1779
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion UE4SS/src/Mod/LuaMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(Stack.Locals());
void* data{};
if (param->HasAnyPropertyFlags(Unreal::EPropertyFlags::CPF_OutParm))
{
data = Unreal::FindOutParamValueAddress(Stack, param);
}
else
{
data = param->ContainerPtrToValuePtr<void>(Stack.Locals());
}
const LuaType::PusherParams pusher_param{
.operation = LuaType::Operation::GetParam,
.lua = lua,
Expand Down
1 change: 1 addition & 0 deletions assets/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(<new-value>)`

### C++ API
Finalize C++ API. - LocalCC; Truman
Expand Down
2 changes: 1 addition & 1 deletion deps/first/Unreal

0 comments on commit b7e1779

Please sign in to comment.