⚡
Easier · zero-config
Declarative GetFunction / [LuaMarshalAs], lazy CSharp loading; no per-type C# Wrap allowlist, no raw Lua C API.
🚀
Faster · ~2.62×
Il2Cpp benchmarks: ~98% of aligned cases beat xLua; Lua→C# ~2.62× on average; common field / property access ~4×.
📦
Smaller bridge · less GC
Signature-merged C++ stubs can be an order of magnitude smaller; reference types and structs default to 0 GC, with OpaqueValue and related strategies.
Bidirectional calls at a glance
- C# → Lua
- Lua → C#
C# · GetFunction
// Bootstrap.cs
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void InitZLuaOnStartup()
{
LuaAppDomain.Initialize(LoadLuaModule);
}
Action AppMain;
Func<int, int, int> AppAdd;
void Awake()
{
AppMain = LuaAppDomain.GetFunction<Action>("app", "main");
AppAdd = LuaAppDomain.GetFunction<Func<int, int, int>>("app", "add");
}Lua · app.lua
-- app.lua
local function main()
print("lua main start")
end
local function add(a, b)
return a + b
end
return {
main = main,
add = add,
}CSharp['AC'] = CSharp['Assembly-CSharp']
local function main()
local demo = CSharp.AC.Demo()
demo.x = 10
print("Demo.Add:", CSharp.AC.Demo.Add(3, 5))
end
return { main = main }