Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule zui.module·originates fromworld 07158574-5…

dynamic

`Z.dynamic(list, fn)` — one screen per list item. The `Z.app` mount/tick loop recognises the wrapper and registers `<base>-<item.id>` screens; on every tick it diffs against the previously-registered ids and unregisters screens whose items disappeared.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

dynamic

Z.dynamic(list, fn) — one screen per list item. The Z.app mount/tick loop recognises the wrapper and registers <base>-<item.id> screens; on every tick it diffs against the previously-registered ids and unregisters screens whose items disappeared.

Exports

  • Dynamic.create(list: { any }, fn: (any, number) -> any) -> Wrapper — build a dynamic-list bucket consumed by Z.app.
  • Dynamic.is(value: any) -> boolean — identify a Z.dynamic(...) wrapper.
  • Dynamic.itemId(item: any, index: number) -> string — derive a stable per-item id (falls back to the array index).

Types:

  • Wrapper = { list, fn, ... } — opaque wrapper carrying the __zuiDynamic = true tag.

Usage

local Dynamic = require("@builtin::modules.zui.dynamic")
local Z       = require("@builtin::modules.zui")

return Z.app("inventory", function(state)
    return {
        items = Z.dynamic(state.items, function(item, index)
            return Z.lbl(item.label)
        end),
    }
end)

Notes

  • The wrapper carries an internal __zuiDynamic = true tag — call Dynamic.is(v) instead of inspecting keys directly.
  • Each item should expose a stable .id field; without one, the screen name uses the array index, which makes ordering changes feel like add/remove events.
  • The list is read by reference on every tick — mutating it between ticks is the normal way to drive add/remove/reorder.
  • Unregistration is automatic: when an item disappears from the list, its per-item screen is unregistered on the next tick.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

ZuiDynamic Module `Z.dynamic(list, fn)` — one screen per list item. The App's mount/tick recognises the wrapper and registers `<base>-<item.id>` screens; on every tick it diffs against the previously-registered ids and unregisters disappeared screens. Consumers: local Dynamic = require("modules.deprecated.zui.dynamic") Dynamic.create(items, function(item, index) return ... end)

create(list: { any }, fn: (any, number) →

Construct a dynamic-list bucket. `list` is the live array of items the App reads each tick; `fn(item, index)` returns the widget tree for one item. Each item must carry a stable `id` field — the App uses it to compute the per-item screen name `<base>-<item.id>` and to diff against the previous tick's set.

argtypedescription
list{ any }The live array of items.
fn(any, number`(item, index) -> widget` builder for a single item.

examples

Z.dynamic(items, function(item, i) return Z.lbl(item.label) end)

is(value: any) → boolean

True if `value` is a `Z.dynamic(...)` wrapper. The App calls this when walking the builder's return table to decide between `register single screen` vs `register one screen per list item`.

argtypedescription
valueanyCandidate value.

examples

if Dynamic.is(v) then ... end

itemId(item: any, index: number) → string

Stable per-item id. Falls back to the array index when the item doesn't carry one — keeps the API forgiving for prototypes that add `.id` later.

argtypedescription
itemanyThe list item.
indexnumberThe 1-based array position.

examples

local id = Dynamic.itemId(item, i)
⌬ Types
Wrapper = {

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

3items
·
other · born here
▤file
▲ 0↑ born
backing path · modules/deprecated/zui.module/dynamic.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.