Marshal Spec (spec/marshal/)
Normative: C# ↔ Lua value shapes on the stack and conversion rules. Implementation: → ../../impl/marshal/.
This directory
| File | Contents |
|---|---|
| 01-OVERVIEW.md | Default marshal matrix, integer/number, array summary, reference façade summary |
| 02-MARSHAL-AS.md | [LuaMarshalAs], LuaMarshalType, legal sets, Table/Unpacked/Params/Bytes/UserData/Opaque, XML external config |
| 03-BYREF.md | ref / in / out (C#→Lua Opaque; Lua→C#: Opaque/ByVal pass address; otherwise temp slots) |
| 04-OPAQUE.md | OpaqueValue, get_opaquevalue / set_opaquevalue, lifetime, pass-back split |
| 05-STRUCT.md | struct ByVal / ByObj / Handle, box/unbox |
| 06-CLASS.md | class / interface / declared-type façade |
| 07-ARRAY.md | szarray / mdarray / Bytes |
| 08-ENUM.md | Default integer + zlua.box |
| 09-FUNCTION.md | Delegate ↔ Lua function |
| 10-POINTER.md | T*, function pointers, unsupported types |
Reading order
- 01-OVERVIEW.md — default behavior overview
- 02-MARSHAL-AS.md — when to override defaults; how to configure Table/Unpacked/Params
- By type: 05-STRUCT / 06-CLASS / 07-ARRAY / 08-ENUM / 09-FUNCTION
- Bidirectional byref fork: Lua→C# → 03-BYREF.md; C#→Lua → 04-OPAQUE.md
Cross-references
| Topic | Other specs |
|---|---|
CSharp type tables, construction entry | ../02-TYPE-SYSTEM.md |
| Overloads and argument matching | ../04-METHOD-OVERLOAD.md |
zlua.box / unbox / cast / get_opaquevalue / set_opaquevalue | ../05-LIB.md |
| Metatables and member indexing (not Marshal) | ../metatable/ |
Platform principles
- Mono (Editor) and Il2Cpp (Player) share the same Lua-visible Marshal semantics; differences exist only in
impl/. - No Event-specific support; use ordinary
add_*/remove_*methods (see ../../README.md).