zlua-marshal
/zlua-marshal
Opisuje domyślne przekazywanie wartości między Lua a prymitywami, łańcuchami, enumami i strukturami C#.
- Autor
- killop ↗
- Repozytorium
- unity-mcp ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 02.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 02.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Opisuje domyślne przekazywanie wartości między Lua a prymitywami, łańcuchami, enumami i strukturami C#.
Oryginalny opis (EN)
Describes default ZLua marshaling between Lua values and C# primitives, strings, enums, structs, classes, and Nullable. Use when choosing how a value crosses the Lua and C# boundary, or when a table or bare number is the wrong shape.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 31 linii, 253 słów
Podgląd SKILL.md
---
name: zlua-marshal
description: >-
Describes default ZLua marshaling between Lua values and C# primitives,
strings, enums, structs, classes, and Nullable. Use when choosing how a value
crosses the Lua and C# boundary, or when a table or bare number is the wrong shape.
---
# Default marshal
Use these shapes unless `[LuaMarshalAs]` or MarshalAs XML says otherwise. Attribute and XML syntax is `zlua-marshal-as`. `ref` / `in` / `out` write-back is `zlua-in-ref-out`. Arrays are `zlua-array`. Delegates are `zlua-delegate`.
| C# type | Default Lua shape |
|---------|-------------------|
| `bool`, integers, floats, `char` | Lua boolean or number |
| `string` | Lua string (a copy). A huge string can be forced to ByObj with `LuaMarshalType.UserData` |
| `enum` | Integer / number. The type table has no `__call`. Do not write `Color(...)`. Boxed enums use `zlua.box` |
| `struct` | ByVal userdata from `Type(...)` or `Type._default()`. A Lua table is not a struct |
| `class` / interface / array / delegate | ByObj userdata, or `nil` for null |
| `Nullable<T>` | Same as `T` when it has a value; `nil` when it does not |
```lua
local Point2D = CSharp.AC['MyGame.Point2D']
local p = Point2D(3, 4) -- ByVal userdata
p.X = 10
host:SetPoint(p) -- by-value parameter copies
local Color = CSharp.AC['MyGame.Color']
host:SetColor(Color.Red) -- enum constant is an integer
host:SetColor(1)
```
Passing a struct by value copies it. Passing the same ByVal userdata to `ref` / `in` of that struct type writes back into the userdata.
Do not invent `{ X = 1, Y = 2 }` or `Foo(x, y)` as the default struct form. That requires `LuaMarshalType.Table` (one table) or `UnpackedValues` (N stack slots) on the slot or the type. See `zlua-marshal-as`.
`nil` is null only for reference types and `Nullable<T>`. A non-nullable value type rejects `nil`.
Wersje
W bazie nie ma innych skilli o nazwie zlua-marshal.
Migawka bazy z 13.11.2026 · wersja paczki 920789644f4a (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 95zlua-marshal-as
Zmienia domyślne przekazywanie danych ZLua przez atrybut LuaMarshalAs lub XML ZLuaMarshalAs, dla typów takich jak Bytes czy Table. - 95zlua-array
Tworzy i indeksuje tablice C# z poziomu Lua przy pomocy pomocników zlua, konwertując je do tabel i bajtów. - 90lua-guide
Pomaga pisać ogólne skrypty Lua 5.4+: moduły, zakresy zmiennych, metatabele, korutyny i obsługę błędów w plikach .lua. - 85Lua C Integration
Omawia Lua C API do rozszerzania Lua kodem natywnym: operacje na stosie, wywołania C z Lua i odwrotnie, moduły C, userdata, metatabele i optymalizacje wydajności. - 81Lua Coroutines
Wyjaśnia koroutyny Lua do kooperatywnej wielozadaniowości: tworzenie, yield i resume, przekazywanie wartości, generatory, iteratory, wzorce asynchroniczne, maszyny stanów i producent-konsument. - 100lua-guide
Podaje zasady i wzorce Lua dla programowania wspomaganego AI: tablice, metatabele, korutyny i konwencje osadzania, dla LuaJIT, Neovim i Love2D.