Skip to content

Latest commit

 

History

History
44 lines (23 loc) · 1.14 KB

How_To_Implement_Overriding.md

File metadata and controls

44 lines (23 loc) · 1.14 KB

Overview

The main feature of UnLua is overriding 'BlueprintEvent', 'AnimNotify', 'RepNotify', 'InputEvent' without helper codes. This document will introduce the two methods to implement overriding.


Thunk Function Replacement

Thunk function of UFunction

THUNK_FUNC

'Func' is the thunk function.

UFunction invoking

UOBJECT_PROCESSEVENT

UFUNCTION_INVOKE

If replacing the engine's default thunk function with a customized thunk function that calling Lua function, we can override the UFunction.


Opcode Injection

There is another path to call non-native UFunction:

UOBJECT_CALLFUNCTION

Replacing thunk function is useless in this case, and we can inject special Opcodes to UFunction to implement overriding.

New opcode definition

NEW_OPCODE

New opcode registering

OPCODE_REGISTRAR

Injection

OPCODE_INJECTION

CUSTOMIZED_THUNK_FUNC