▣
module · drop-in viewer
tags
Luau-owned screen-tag registry for zui. Tags are pure derived metadata over the `ui.hideScreen` / `ui.showScreen` / `ui.listScreens` capabilities; the source of truth lives here, not in the engine. Typical use is the editor F1 toggle — every editor-owned UI screen is tagged `"edi…
by·posted 2mo ago
What it does
tags
Luau-owned screen-tag registry for zui. Tags are pure derived metadata
over the ui.hideScreen / ui.showScreen / ui.listScreens
capabilities; the source of truth lives here, not in the engine. Typical
use is the editor F1 toggle — every editor-owned UI screen is tagged
"editor" at register time and the editor's default scene flips them all
in one call via hideByTag / showByTag.
Exports
M.set(name: string, tags: { string }?)— replacename's tag set with the array. Nil/empty clears.M.add(name: string, tag: string)— add a single tag, creating the entry if absent.M.remove(name: string, tag: string)— drop a tag; drops the registry entry when the set becomes empty.M.clear(name: string)— drop every tag forname(idempotent).M.get(name: string) -> { string }— sorted array of tags forname(empty when no entry).M.findByTag(tag: string) -> { string }— sorted screens currently registered AND visible-via-ui.listScreenscarryingtag.M.hideByTag(tag: string)— hide every currently-visible screen tagged withtag.M.showByTag(tag: string)— show every currently-hidden screen tagged withtag.M._registry: Registry— internal{ [name] = { [tag] = true } }map. Inspectable but treat as private.
Types:
TagSet = { [string]: boolean }Registry = { [string]: TagSet }ScreenInfo = { name: string, visible: boolean }LiveScreens = { [string]: ScreenInfo }
Usage
local Tags = require("@builtin::modules.zui.tags")
Tags.set("inspector", { "editor" })
Tags.add("console", "editor")
Tags.hideByTag("editor") -- hides every visible "editor"-tagged screen
Tags.showByTag("editor") -- shows every hidden "editor"-tagged screen
local screens = Tags.findByTag("editor") -- sorted live matches
Notes
- Registry is not auto-pruned.
ui.listScreens()is one frame behind, so same-frame register-then-tag flows must keep their entries intact; bulk ops filter via the live screen snapshot. - Memory is bounded by total session screen count.
setwithnil/{}is the only way to clear an entry throughset; useclear(name)for the explicit variant.- All bulk ops are silent on missing FFI bindings (
ui.hideScreen,ui.showScreen,ui.listScreens) — safe to call before the UI layer is wired.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.