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

screens

Derived screen-lifecycle helpers on top of the `ui.*` capability surface. Every operation is computed from `ui.listScreens()` + `ui.hideScreen` / `ui.showScreen`; the module owns no engine state of its own. Deliberately does NOT wrap `ui.registerScreen` / `ui.updateScreen` / `ui.…

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

screens

Derived screen-lifecycle helpers on top of the ui.* capability surface. Every operation is computed from ui.listScreens() + ui.hideScreen / ui.showScreen; the module owns no engine state of its own. Deliberately does NOT wrap ui.registerScreen / ui.updateScreen / ui.unregisterScreen — those are capabilities the engine needs to manage directly.

Exports

  • M.exists(name: string) -> boolean — does the screen exist in the current snapshot?
  • M.visible(name: string) -> boolean — does it exist AND is it currently shown?
  • M.toggle(name: string) — flip a visible screen hidden, or a hidden screen visible. Unknown screens are no-ops.
  • M.list() -> { ScreenEntry } — pass-through to ui.listScreens().
  • M.byName() -> { [string]: ScreenEntry } — same data, map shape.
  • M.hideAll() — hide every currently-visible screen.

Types:

  • ScreenEntry = { name: string, visible: boolean, layer: number?, hasRoot: boolean? }

Usage

local Screens = require("@builtin::modules.zui.screens")
if Screens.visible("hud") then Screens.toggle("hud") end

Notes

  • The screen snapshot is one frame behind on register/update commands — a freshly registered screen returns false from exists until the next frame.
  • toggle is a state-driven flip, not a flag write — it reads the current state before deciding to show or hide.
  • All operations are safe when the ui global is unavailable; they no-op or return empty values.

Interface

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

conforms to

zero/source-extract/v2

ZuiScreens Module Derived screen-lifecycle helpers on top of the `ui.*` capability surface. Every operation here is computed from `ui.listScreens()` + `ui.hideScreen` / `ui.showScreen`; no engine state of its own. This module deliberately does NOT wrap `ui.registerScreen` / `ui.updateScreen` / `ui.unregisterScreen`. Those are capabilities (the engine needs to know the widget tree, the cached Lua ref, the WIDGET_STATE sweep on unregister) and adding wrappers would just rename them with no behaviour added. Use them directly, or go through `Z.app(name, builderFn)` which owns the full register-or-update lifecycle. Consumers: local Screens = require("modules.deprecated.zui.screens") if Screens.visible("hud") then Screens.toggle("hud") end

snapshot( ) → void

Internal: build a `{ [name] = entry }` lookup from the engine's per-frame screen snapshot. One FFI call per query; the snapshot is already cached on the engine side so this is cheap.

exists(name: string) → boolean

Does a screen with this name exist in `ui.listScreens()`? A screen the running script registered counts, and one it unregistered does not.

argtypedescription
namestringThe screen name to look up. Non-string or empty values

examples

if Screens.exists("hud") then ... end

visible(name: string) → boolean

Is the named screen currently visible? Returns `false` when the screen doesn't exist OR exists but is hidden.

argtypedescription
namestringThe screen name to query. Non-string or empty values

examples

if Screens.visible("hud") then ... end

toggle(name: string) → void

Toggle a screen: visible → hidden via `ui.hideScreen`, hidden → visible via `ui.showScreen`. Unknown screens are silent no-ops. are silently ignored.

argtypedescription
namestringThe screen name to toggle. Non-string or empty values

examples

Screens.toggle("hud")

list( ) →

Pass-through to `ui.listScreens()` — array of `{ name, visible, layer, hasRoot }` entries sorted by layer ascending then name. Provided for parity with the rest of `Z.screens`. the `ui` global is unavailable.

examples

for _, s in ipairs(Screens.list()) do print(s.name) end

byName( ) →

Same data as `list()` but `{ [name] = entry }` shape for O(1) lookup.

examples

local map = Screens.byName(); print(map.hud.visible)

hideAll( ) → void

Hide every currently-visible screen. No-op when nothing is visible or the `ui` global has no `hideScreen`.

examples

Screens.hideAll()
⌬ Types
ScreenEntry = {

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/screens.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.