RegisterCallFunctionByNameWithArgumentsPostHook
注册一个回调,在调用 UObject::CallFunctionByNameWithArguments 后执行。
除字符串、布尔值和 FOutputDevice 外,参数必须通过 Param:Get() 读取,通过 Param:Set() 设置。
如果回调不返回任何值(或返回 nil),则使用 CallFunctionByNameWithArguments 的原返回值。
如果回调返回 true 或 false,该值会覆盖 CallFunctionByNameWithArguments 的原返回值。
参数
| # | 类型 | 说明 |
|---|---|---|
| 1 | function | 要注册的回调 |
回调参数
| # | 类型 | 说明 |
|---|---|---|
| 1 | UObject | 对象上下文 |
| 2 | string | 字符串 |
| 3 | FOutputDevice | AR 输出设备 |
| 4 | UObject | 执行者 |
| 5 | bool | bForceCallWithNonExec 的值 |
回调返回值
| # | 类型 | 说明 |
|---|---|---|
| 1 | bool | 是否覆盖 CallFunctionByNameWithArguments 的原返回值 |
示例
译注:本页介绍后置钩子,但原文示例最后一行调用了
RegisterCallFunctionByNameWithArgumentsPreHook。代码按原文保留;注册后置钩子时应使用本页标题中的RegisterCallFunctionByNameWithArgumentsPostHook。
local function MyCallback(Context, Str, Ar, Executor, bForceCallWithNonExec)
-- Do something with the parameters
-- Return nil to use the original return value of CallFunctionByNameWithArguments
-- Return true or false to override the original return value of CallFunctionByNameWithArguments
return nil
end
RegisterCallFunctionByNameWithArgumentsPreHook(MyCallback)
---
原文:[docs/lua-api/global-functions/registercallfunctionbynamewithargumentsposthook.md](https://github.com/UE4SS-RE/RE-UE4SS/blob/560411f18512b6c9395285e55624de4b91a2c45b/docs/lua-api/global-functions/registercallfunctionbynamewithargumentsposthook.md) · 固定提交 `560411f18512` · [来源与 MIT 许可](/wiki/9/license)