-
Notifications
You must be signed in to change notification settings - Fork 0
Transparent rewrite
How a generic call written in script becomes a typed, key-baked call without the script being edited.
NotifyObjectMessage(self, "Player.Hurt", dmg, causer)A generated per-tag function with the key already baked and typed argument decoding.

The hook point is wherever that toolchain can be reached before execution:
| Backend | Stage | Mechanism |
|---|---|---|
| UnLua | load time, on the text | FUnLuaDelegates::CustomLoadLuaFile |
| slua | load time, on the text | setLoadFileDelegate |
| AngelScript | before compilation | preprocessor hook (OnPostProcessCode) |
| Puerts | during compilation | AST transform inside tsc
|
| C# | not rewritten | statically typed already; generic MsgTag<T...> pins types at compile time |
The two lua backends share one rewriter — same lexing problem, so the same implementation handles both.
The generic entry point has to look the tag up by name and unpack arguments dynamically, because it cannot know which tag it is. A generated function knows, so both costs disappear. Rewriting is what lets the script author keep the readable generic form while the binary gets the specific one.
| Backend | Emitted |
|---|---|
| UnLua / slua | EmmyLua ---@param annotations |
| Puerts | gmp_messages.d.ts |
| AngelScript | declaration stubs |
| C# | generic MsgTag<T...>
|

- The rewriter matches call syntax. A call assembled dynamically — the function fetched into a variable first, or the tag built by concatenation — is not rewritten. It still works, on the generic path.
- Static binding per backend is behind its own switch (
GMP_SLUA_STATIC_BIND,GMP_UNLUA_STATIC_BIND,GMP_PUERTS_STATIC_BIND,GMP_CSHARP_STATIC_BIND), all default0.
Key baking · Signature inference · Build switches · FGMPRawSig
GMP · Reference wiki — one page per named thing. Guided introduction: project site · 中文站点 · measured dispatch stack Source: repository · README · README 中文
Pages here are generated from wiki/ in the main repository — edit there, not on the wiki.
Concepts
- Why a string key
- Dispatch layers
- Parameter compatibility
- Signature inference
- Key baking
- Transparent rewrite
- Jump tracing
Sending and listening
- NotifyMessage family
- ListenMessage family
- StoreObjectMessage
- MSGKEY
- FSigSource
- FSigHandle
- FGMPKey
- FGMPResponder
Dispatch internals
Reflection and data
Editor
Build