Builtin Library
README.md
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 toui.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
falsefromexistsuntil the next frame. toggleis 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
uiglobal is unavailable; they no-op or return empty values.