Skip to main content

zlua.types

zlua.types is initialized when zlualib.lua loads. It provides common System type full-name strings usable directly as typeArgs for zlua.signature, zlua.make_generic_type, zlua.box, etc. — shorthand for zlua.typeof(CSharp.mscorlib....).

Source: ZLua~/lualib/zlualib.lua

:::info Naming change The old name zlua.corlibtypes is deprecated; use zlua.types. :::

Full Constants Table

Lua keySystem typeTypical use
zlua.types.voidSystem.VoidSignature-only scenarios (e.g. no-arg ctor)
zlua.types.boolSystem.Booleansignature, generic type args
zlua.types.charSystem.Charsignature
zlua.types.byteSystem.Bytesignature
zlua.types.sbyteSystem.SBytesignature
zlua.types.shortSystem.Int16signature
zlua.types.ushortSystem.UInt16signature
zlua.types.intSystem.Int32signature (same as int32)
zlua.types.int32System.Int32signature, generic type args
zlua.types.uintSystem.UInt32signature
zlua.types.longSystem.Int64signature
zlua.types.ulongSystem.UInt64signature
zlua.types.floatSystem.Singlesignature
zlua.types.doubleSystem.Doublesignature
zlua.types.intptrSystem.IntPtrsignature
zlua.types.uintptrSystem.UIntPtrsignature
zlua.types.decimalSystem.DecimalDeclared; interop unsupported by default
zlua.types.objectSystem.ObjectGeneric type args, signatures
zlua.types.stringSystem.Stringsignature

Usage Examples

Method signature / full-signature key

-- zlua.signature only builds the parameter parentheses; full-signature key = method name .. sig
local sig = zlua.signature(zlua.types.int32, zlua.types.string)
-- When multiple same-name candidates exist, Bind already hung the key; use directly:
-- demo['SomeMethod(System.Int32,System.String)'](demo, …)

Closing a generic

local list_int = zlua.make_generic_type(CSharp.mscorlib['System.Collections.Generic.List`1'], zlua.types.int32)

Choosing zlua.typeof / get_type_from_name

ScenarioPrefer
corlib primitives / string / objectzlua.types.*
Game-assembly types (Demo, Point2D)CSharp.AC.Demo type table, or zlua.typeof(...)
Closed generic / array type table → System.Typezlua.typeof(ListInt) (≡ C# typeof(List<int>))
Single-string parse (AQN / generic / array)zlua.get_type_from_name(...)
Generic definition (open List\1`)Type table + make_generic_type

Mono / Il2Cpp Support

RuntimeSupport
Mono
Il2Cpp