Functions
Creating menu windows, the game's Settings window, buttons of the ESC menu.
Windows (Menu) in the style of the game's Settings screen and buttons of the ESC menu (MenuButton).
Menus
createMenu
createMenu(title)Creates a window in the style of the game's Settings screen - tabs with controls (see Menu).
The window is only described here; it is shown with menu:open(), a button of the ESC menu
(addMenuButton) or a button of another window (MenuPage:addButton).
local menu = createMenu("Lorem ipsum")
local page = menu:addPage("Dolor sit")
page:addToggle("Consectetur", true)
addMenuButton("Lorem ipsum", menu)| Parameter | Type | Description |
|---|---|---|
title | string | Title shown at the top of the window. |
Returns: Menu - The new window.
getSettingsMenu
getSettingsMenu()Returns the game's own Settings window (ESC - SETTINGS). Scripts can add their tabs to it
(getSettingsMenu():addPage("Lorem ipsum")) - they appear after the game's tabs. It cannot be
opened, closed, renamed or removed by scripts.
Returns: Menu - The game's Settings window (always the same object).
addMenuButton
addMenuButton(text, action)Adds a button to the ESC menu (between SETTINGS and QUIT, in the order of adding). Clicking it calls the function or opens the given window.
addMenuButton("Lorem ipsum", menu)
addMenuButton("Dolor sit amet", function() addChatMessage("Lorem ipsum dolor sit amet.") end)| Parameter | Type | Description |
|---|---|---|
text | string | Text of the button. |
action | fun() | Menu | Function called on click (no arguments), or a window to open. |
Returns: MenuButton - The new button.
isMenuOpen
isMenuOpen()Tells whether the ESC menu or any window opened from it (the game's Settings, a script window) is open.
Returns: boolean
closeMenu
closeMenu()Closes the ESC menu together with every window opened on top of it (the game's Settings, script windows) - the player returns to the game.
