Skip to content
Skills Library
Programming · Tool integration

zlua-lib

/zlua-lib

Uses the global zlua table: type arguments, typeof, make_generic_type, arrays, inflate, box, unbox, cast, opaque, and to_delegate. Use when Lua needs a zlua.* helper instead of a CSharp member call.

Repository
unity-mcp ↗
Licence
MIT
Last repository change
02.11.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content30 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Uses the global zlua table: type arguments, typeof, make_generic_type, arrays, inflate, box, unbox, cast, opaque, and to_delegate. Use when Lua needs a zlua.* helper instead of a CSharp member call.

Original author description

Uses the global zlua table: type arguments, typeof, make_generic_type, arrays, inflate, box, unbox, cast, opaque, and to_delegate. Use when Lua needs a zlua.* helper instead of a CSharp member call.

How it works

  1. Type arguments
  2. Common calls
Original SKILL.md headings · 52 lines, 274 words
SKILL.md preview
---
name: zlua-lib
description: >-
  Uses the global zlua table: type arguments, typeof, make_generic_type, arrays,
  inflate, box, unbox, cast, opaque, and to_delegate. Use when Lua needs a zlua.*
  helper instead of a CSharp member call.
---

# zlua library

| Layer | Job |
|-------|-----|
| `CSharp` | Assemblies, types, members, constructors. See `zlua-lua-call-csharp` |
| `zlua` | Type-argument helpers, opaque, box, arrays, delegates, `inflate` |
| Instance userdata | Members go through the metatable, not through `zlua` |

`zlua` does not replace `CSharp`. There is no `make_generic_method` or `register_method`.

## Type arguments

Most constructors accept the same type argument: `zlua.types.*` (for example `zlua.types.int32`), a type table, a type-name string, or a `System.Type`.

| API | Result |
|-----|--------|
| `zlua.types.int32` and the other presets | A ready type argument |
| `zlua.typeof(typeTable)` | `System.Type`, same as C# `typeof` |
| `zlua.get_type_from_name(name)` | Type table. Accepts assembly-qualified names, generics, and arrays. A miss is an error |

GTAP prefixes accept only `System.Type`. Everything else in this table is fine for `inflate` and `make_generic_type`. See `zlua-generic-method`.

## Common calls

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

local arr = zlua.new_szarray_by_element_type(zlua.types.int32, 4)
local t = zlua.to_table(arr)
local bytes = zlua.to_bytes(floatArr)   -- blittable elements; not bool[] or char[]

local GetRb = zlua.inflate(GameObject, "GetComponent", Rigidbody)
local rb = GetRb(go)

local boxed = zlua.box(Color, Color.Red)
local n = zlua.unbox(boxed)
local viewed = zlua.cast(obj, targetType)   -- same object, different facade

local v = zlua.get_opaquevalue(slot)
zlua.set_opaquevalue(slot, newValue)
local copy = zlua.to_user_data(slot)

local del = zlua.to_delegate(fn, closedDelegateType)
```

Deeper rules live in the matching skill: arrays in `zlua-array`, generic methods in `zlua-generic-method`, opaque and byref in `zlua-in-ref-out`, delegates in `zlua-delegate`, signature keys in `zlua-method-overload`.

The native function `__zlua_create_signature(...)` returns a parameter-list string such as `"(System.Int32)"`. It is not wrapped on the `zlua` table yet, and that string alone is not a metatable key. The key is still `Name(Types...)`.

Versions

The database has no other skills named zlua-lib.

Database snapshot: 13.11.2026 · package version ebc4778a49d2 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95zlua-generic-method
    Closes C# generic types and generic methods from Lua with make_generic_type, zlua.inflate, and GTAP typeof prefixes. Use when Lua calls List<T>, Dictionary, GetComponent<T>, or any method that still has its own type parameters.
  • 95zlua-array
    Creates and indexes C# arrays from Lua with zlua szarray and mdarray helpers, to_table, and to_bytes. Use when Lua needs a T[] or a multidimensional array, or when converting an array to a Lua table or a byte string.
  • 100lua-best-practices
    Lua best practices for FiveM resources built on ox_lib, the way Overextended structures its own resources. Use when reading or editing any .lua file or fxmanifest.lua, or when the user asks when to use require, lib.load or lib.loadJson, how to split a resource into modules,…
  • 81Lua Tables Patterns
    Use when lua tables as the universal data structure including arrays, dictionaries, objects, metatables, object-oriented patterns, data structures, and advanced table manipulation for building flexible, efficient Lua applications.
  • 100lua-guide
    Lua language guardrails, patterns, and best practices for AI-assisted development. Use when working with Lua files (.lua), or when the user mentions Lua/LuaJIT/Neovim/Love2D. Provides table patterns, metatable guidelines, coroutine usage, and embedding conventions specific to…
  • 100xmake-scripting
    Use when writing custom Lua script logic inside `xmake.lua` — `on_load`/`on_build`/`after_build` hooks, `import()`, extracting script files under a `modules/` dir, importing xmake core modules (`core.base.option`, `lib.detect.find_tool`, …), or building native C/C++ Lua modules…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.