Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

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 }?) — replace name'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 for name (idempotent).
  • M.get(name: string) -> { string } — sorted array of tags for name (empty when no entry).
  • M.findByTag(tag: string) -> { string } — sorted screens currently registered AND visible-via-ui.listScreens carrying tag.
  • M.hideByTag(tag: string) — hide every currently-visible screen tagged with tag.
  • M.showByTag(tag: string) — show every currently-hidden screen tagged with tag.
  • 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.
  • set with nil / {} is the only way to clear an entry through set; use clear(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.