Builtin Library
- ..
- README.md2.1 KB
- about.yaml527 B
- behavior.luau6.8 KB
- inspector.luau2.0 KB
- template
- type.yaml1.3 KB
README.md
menuTab
One tab of the app menu (appMenu), the menu the pause action opens:
Escape, a gamepad's Start, the on-screen Menu button and a headset's left
menu button, in every profile and on every platform.
A tab is a <name>.menuTab/ folder whose init.luau returns its spec:
return {
title = "Game",
build = function(ctx)
-- ctx.presentation: "desktop" | "phone" | "vr"; ctx.width, ctx.height:
-- the room the body has inside the menu's frame.
return { type = "vertical", children = { ... } }
end,
onCallback = function(id, data) end, -- every callback the body raises
back = function() return false end, -- one step back inside the tab
onShow = function(ctx) end, -- each time the tab comes on screen
}
title is text, or { key = "namespace.key", values? } for the catalog
message the menu says in the player's language each time it draws. A new
world's tab reads the library's app_menu messages that way.
The body is an ordinary widget tree, the one ui.registerScreen takes, so a
tab looks the way its world draws it. The menu draws the frame around it:
Resume (back to the world), Enter or Exit VR, Recenter in a headset, and the
tabs, across the top on a desktop, along the bottom on a phone, and along
the bottom edge of the panel in a headset.
Which tabs the menu counts is decided by where the asset lives:
- The world's own source (
/source, outsidelibs/anddeps/): the world's tab, shown first as the World tab whatever the folder is named. A new world starts with one,menuTabs/game.menuTab, which the world rewrites for its game. A world with none shows its title, Resume and the way to another world. - The built-in library: the engine's tabs, ZeroMind
(
@builtin::menuTabs.zeromind) and System (@builtin::menuTabs.system). - Anywhere else, another library or the dependency tree of a world installed into this one: nothing. An installed world brings its content and no menu of its own.
Opening the menu pauses nothing: every world is shared, and keeps running. Menu tabs stay out of search.