Wax

ui

Windows, overlays, notifications, hotkeys, themes and icons: everything under ui.

ui

The GUI library: the menu (windows you click), overlays (panels you only read) and notifications.

Type name: WaxUI.

MemberTypeDescription
IconsWaxIconsIcon names: the bundled Lucide set ("shield", "wrench", "map-pin" ...) plus images that mods register.
NotificationsWaxNotifications
DebugWaxDebugPanelThe in-game debug panel.
SignalHandler receivesDescription
OpenednothingFires when the menu opens.
ClosednothingFires when the menu closes.
KeyChangedkey: string?Fires with the new menu key.
ThemeChangedname: stringFires with the theme's name after SetTheme or ResetTheme.

ui.Open()

Opens the menu: windows appear and the mouse is freed to use them.

ui.Open()

Returns nothing.

ui.Close()

Closes the menu and gives the mouse back to the game.

ui.Close()

Returns nothing.

ui.Toggle()

Opens the menu when it is closed, and closes it when it is open.

ui.Toggle()

Returns nothing.

ui.Copy(text)

Puts text on the clipboard, for pasting anywhere.

ui.Copy(text: any)
ParameterType
textany

Returns nothing.

ui.IsOpen()

True while the menu is open.

ui.IsOpen(): boolean

Returns boolean

ui.SetPreview(on)

Shows the windows without taking the mouse (for screenshots and for looking while you play).

ui.SetPreview(on: boolean)
ParameterType
onboolean

Returns nothing.

ui.IsPreview()

True while the windows are shown in preview.

ui.IsPreview(): boolean

Returns boolean

ui.SetToggleKey(key)

Sets the key that opens and closes the menu, by the engine's key name ("F8"). nil leaves the menu without a key.

ui.SetToggleKey(key: string?)
ParameterType
keystring?

Returns nothing.

ui.GetToggleKey()

The key that opens and closes the menu.

ui.GetToggleKey(): string?

Returns string?

ui.Window(options?)

Creates a window in the menu. It is removed again when the mod reloads.

ui.Window(options?: WaxWindowOptions): WaxWindow
ParameterType
options (optional)WaxWindowOptions

Returns WaxWindow

ui.Overlay(options?)

Creates a panel pinned to the screen that stays up during play and lets clicks through.

ui.Overlay(options?: WaxOverlayOptions): WaxOverlay
ParameterType
options (optional)WaxOverlayOptions

Returns WaxOverlay

ui.Tag(target, options?)

Puts a line of text over an actor, over one part of an actor, or on a spot in the world. It follows what it is on, shows through walls, and tags that would cover each other pile up. The tag goes away by itself when the actor does.

ui.Tag(target: WaxInstance|{ X: number, Y: number, Z: number }, options?: WaxTagOptions): WaxTag
ParameterType
targetWaxInstance | { X: number, Y: number, Z: number }
options (optional)WaxTagOptions

Returns WaxTag

ui.Notify(text, options?)

Shows a short message in a corner of the screen. Sending the same message again restarts the one already showing.

ui.Notify(text: any, options?: WaxNotifyOptions): WaxNotification
ParameterType
textany
options (optional)WaxNotifyOptions

Returns WaxNotification

ui.Windows()

A list of every window.

ui.Windows(): WaxWindow[]

Returns WaxWindow[]

ui.Hotkey(key, callback, options?)

Runs callback when the key is pressed during play. The hotkey is removed when the mod reloads.

ui.Hotkey(key: string, callback: fun(), options?: WaxHotkeyOptions): WaxHotkey
ParameterTypeDescription
keystringAn engine key name such as "F6", "K" or "MiddleMouseButton" (a Keybind control gives you these).
callbackfun()
options (optional)WaxHotkeyOptions

Returns WaxHotkey

ui.MinScale()

The smallest scale that still draws text at a readable size on this screen.

ui.MinScale(): number

Returns number

ui.SetScale(scale)

Sets the interface size, where 1 is normal. The size is kept between ui.MinScale() and 2, and the size applied is returned.

ui.SetScale(scale: number): number
ParameterType
scalenumber

Returns number (applied)

ui.GetScale()

The interface size in use.

ui.GetScale(): number

Returns number

ui.SetTheme(theme)

Switches to a named theme, or changes single settings from a table. Everything on screen takes the new colours in place, so no window is rebuilt and no mod is reloaded. Sizes and shapes apply to what is built afterwards.

ui.SetTheme(theme: WaxThemeName|WaxThemeSettings)
ParameterType
themeWaxThemeName | WaxThemeSettings

Returns nothing.

ui.ResetTheme()

Puts every theme setting back to the "Midnight" defaults.

ui.ResetTheme()

Returns nothing.

ui.Themes()

The names of the built-in themes, then of the ones added with AddTheme.

ui.Themes(): string[]

Returns string[]

ui.AddTheme(name, colors)

Adds a theme: a table with any of the colour settings (window, panel, raised, text, accent ...) as "#RRGGBB".

ui.AddTheme(name: string, colors: WaxThemeSettings)
ParameterType
namestring
colorsWaxThemeSettings

Returns nothing.

ui.ThemeName()

The name of the theme in use.

ui.ThemeName(): string

Returns string

ui.Color(hex, alpha?)

Makes a colour from "#RRGGBB" or 0xRRGGBB, with an optional alpha of 0..1.

ui.Color(hex: string|integer, alpha?: number): WaxColor
ParameterType
hexstring | integer
alpha (optional)number

Returns WaxColor

ui.Theme()

The table of the theme in use. Its colours follow the theme, so pass them as they are (color = ui.Theme().accent).

ui.Theme(): WaxTheme

Returns WaxTheme

ui.AddSettings(container)

Adds the menu's own settings (key, theme, accent, animation, size) to a container, such as a "Settings" page.

ui.AddSettings(container: WaxContainer)
ParameterType
containerWaxContainer

Returns nothing.

ui.Notifications

Type name: WaxNotifications.

ui.Notifications.SetCorner(name)

Moves notifications to another corner of the screen, closing the ones showing.

ui.Notifications.SetCorner(name: WaxCorner)
ParameterType
nameWaxCorner

Returns nothing.

ui.Notifications.SetLimit(count)

Sets how many notifications show at once (at least 1).

ui.Notifications.SetLimit(count: number)
ParameterType
countnumber

Returns nothing.

ui.Notifications.Clear()

Closes every notification.

ui.Notifications.Clear()

Returns nothing.

ui.Notifications.Count()

How many notifications are showing.

ui.Notifications.Count(): integer

Returns integer

ui.Icons

Icon names: the bundled Lucide set ("shield", "wrench", "map-pin" ...) plus images that mods register.

Type name: WaxIcons.

ui.Icons.Names()

Every icon name, sorted. The menu's Icons page shows them.

ui.Icons.Names(): string[]

Returns string[]

ui.Icons.Has(name)

True when there is an icon with this name.

ui.Icons.Has(name: string): boolean
ParameterType
namestring

Returns boolean

ui.Icons.Find(text?, limit?)

Names containing the text, at most limit of them (every name when the text is empty).

ui.Icons.Find(text?: string, limit?: integer): string[]
ParameterType
text (optional)string
limit (optional)integer

Returns string[]

ui.Icons.Register(name, file)

Adds an icon from a PNG file. White on transparent works best, because the icon is tinted when drawn.

ui.Icons.Register(name: string, file: string)
ParameterType
namestring
filestring

Returns nothing.

ui.Debug

The in-game debug panel.

Type name: WaxDebugPanel.

ui.Debug.Page(name, options?)

Adds a page to the debug panel for the calling mod. The page is removed when the mod reloads.

ui.Debug.Page(name: string, options?: WaxPageOptions): WaxPage
ParameterType
namestring
options (optional)WaxPageOptions

Returns WaxPage

ui.Debug.Window()

The debug panel's window, or nil while the panel is not running.

ui.Debug.Window(): WaxWindow?

Returns WaxWindow?

ui.Debug.Show()

Shows the debug panel and opens the menu.

ui.Debug.Show()

Returns nothing.

WaxPage

A page of a window that has navigation. It is a container for controls.

It can also do everything WaxContainer can. You get one from window:Page, ui.Debug.Page.

SignalHandler receivesDescription
NearEndnothingFires while the end of the page is in view: when the user scrolls close to the bottom, and a few times a second while the page is not full. Add more content in the handler, or do nothing when there is no more.

WaxWindow

A window in the menu. Controls added to it go into its body, or into a first page called "Main" when it has pages.

It can also do everything WaxContainer can. You get one from ui.Debug.Window, ui.Window, ui.Windows. Below, window stands for one of these.

SignalHandler receivesDescription
OpenednothingFires when the window is shown.
ClosednothingFires when the window is hidden.
PageChangedname: stringFires with the name of the page that was selected.

window:SetTitle(title)

Changes the text in the title bar.

window:SetTitle(title: string)
ParameterType
titlestring

Returns nothing.

window:SetPosition(x, y)

Moves the window, keeping it on the screen.

window:SetPosition(x: number, y: number)
ParameterType
xnumber
ynumber

Returns nothing.

window:SetSize(width, height)

Resizes the window, no smaller than its minimum size.

window:SetSize(width: number, height: number)
ParameterType
widthnumber
heightnumber

Returns nothing.

window:SetNavWidth(width)

Sets the width of the navigation column of a window made with nav = "side".

window:SetNavWidth(width: number)
ParameterType
widthnumber

Returns nothing.

window:Show()

Shows the window, in front of the others.

window:Show()

Returns nothing.

window:Hide()

Hides the window. Hiding the last one closes the menu.

window:Hide()

Returns nothing.

window:SetVisible(shown)

Shows or hides the window.

window:SetVisible(shown: boolean)
ParameterType
shownboolean

Returns nothing.

window:IsVisible()

True while the window is shown.

window:IsVisible(): boolean

Returns boolean

window:SetMinimized(minimized)

Minimises the window to its title bar, or restores it.

window:SetMinimized(minimized: boolean)
ParameterType
minimizedboolean

Returns nothing.

window:IsMinimized()

True while the window is minimised.

window:IsMinimized(): boolean

Returns boolean

window:StatusBar(text?)

Adds a status line along the bottom of the window, or returns the one the window already has. text sets its message.

window:StatusBar(text?: any): WaxStatusBar
ParameterType
text (optional)any

Returns WaxStatusBar

window:Destroy()

Removes the window and everything on it.

window:Destroy()

Returns nothing.

window:Page(name, options?)

Adds a page to a window made with nav = "side" or "top". The first page added is selected.

window:Page(name: string, options?: WaxPageOptions): WaxPage
ParameterType
namestring
options (optional)WaxPageOptions

Returns WaxPage

window:RemovePage(page)

Removes a page made with Page, with everything on it.

window:RemovePage(page: WaxPage)
ParameterType
pageWaxPage

Returns nothing.

window:SelectPage(name)

Switches to the page with this name.

window:SelectPage(name: string)
ParameterType
namestring

Returns nothing.

WaxStatusBar

The line along the bottom of a window that Window:StatusBar returns.

You get one from window:StatusBar. Below, statusBar stands for one of these.

statusBar:Set(message?, options?)

Shows a message and removes the busy indicator.

statusBar:Set(message?: any, options?: WaxStatusOptions)
ParameterType
message (optional)any
options (optional)WaxStatusOptions

Returns nothing.

statusBar:Busy(message?)

Shows a message with a turning indicator beside it, until the next Set.

statusBar:Busy(message?: any)
ParameterType
message (optional)any

Returns nothing.

statusBar:Progress(amount?)

Shows a thin progress line across the top of the bar. amount is 0..1, and nil hides the line.

statusBar:Progress(amount?: number)
ParameterType
amount (optional)number

Returns nothing.

statusBar:Right(message?)

Shows text at the right-hand end of the bar.

statusBar:Right(message?: any)
ParameterType
message (optional)any

Returns nothing.

statusBar:Clear()

Empties the message and hides the progress line.

statusBar:Clear()

Returns nothing.

WaxOverlay

A panel pinned to the screen that stays up during play and never takes the mouse.

It can also do everything WaxContainer can. You get one from ui.Overlay. Below, overlay stands for one of these.

overlay:SetVisible(shown)

Shows or hides the overlay.

overlay:SetVisible(shown: boolean)
ParameterType
shownboolean

Returns nothing.

overlay:IsVisible()

True while the overlay is shown.

overlay:IsVisible(): boolean

Returns boolean

overlay:SetAnchor(anchor, x?, y?)

Pins the overlay somewhere else. x and y keep their values when omitted.

overlay:SetAnchor(anchor: WaxAnchor, x?: number, y?: number)
ParameterType
anchorWaxAnchor
x (optional)number
y (optional)number

Returns nothing.

overlay:Destroy()

Removes the overlay and everything on it.

overlay:Destroy()

Returns nothing.

WaxNotification

You get one from ui.Notify. Below, notification stands for one of these.

notification:SetText(text)

Replaces the text.

notification:SetText(text: any)
ParameterType
textany

Returns nothing.

notification:SetTitle(title)

Replaces the title. Does nothing on a notification made without one.

notification:SetTitle(title: string)
ParameterType
titlestring

Returns nothing.

notification:SetProgress(amount)

Shows how far a task is, 0..1, in place of the countdown. The notification then stays until closed.

notification:SetProgress(amount: number)
ParameterType
amountnumber

Returns nothing.

notification:Close()

Closes the notification.

notification:Close()

Returns nothing.

WaxTag

A line of text that stays over something in the world.

You get one from ui.Tag. Below, tag stands for one of these.

PropertyTypeDescription
InstanceWaxInstance?What the tag is on. nil for a tag on a spot.

tag:Set(text)

tag:Set(text: string)
ParameterType
textstring

Returns nothing.

tag:SetColor(color)

tag:SetColor(color: WaxColor|string)
ParameterType
colorWaxColor | string

Returns nothing.

tag:SetRange(metres)

tag:SetRange(metres: number)
ParameterType
metresnumber

Returns nothing.

tag:Remove()

Takes the tag off. Safe to call twice, and after the thing it was on is gone.

tag:Remove()

Returns nothing.

WaxHotkey

You get one from ui.Hotkey. Below, hotkey stands for one of these.

hotkey.Disconnect()

Stops the hotkey.

hotkey.Disconnect()

Returns nothing.

hotkey:SetKey(key)

Changes the key it reacts to.

hotkey:SetKey(key: string)
ParameterType
keystring

Returns nothing.

WaxUnknownOption

Stands for any key an options table does not list, so that the editor reports a misspelt option.

WaxOptions

The base of every options table.

OptionTypeDescription
any other key ([string])WaxUnknownOptionStands for any key an options table does not list, so that the editor reports a misspelt option.

WaxColor

A colour in the linear form the engine uses. Make one with ui.Color.

Returned by ui.Color. Used by tag:SetColor, label:SetColor, progress:SetColor, field:SetColor.

FieldType
Rnumber
Gnumber
Bnumber
Anumber

WaxTheme

The theme in use. Its colours change in place when the theme changes, so a colour taken from here (ui.Theme().good) follows the theme wherever you used it. Change the theme with ui.SetTheme, not by writing to this table.

Returned by ui.Theme.

FieldTypeDescription
windowWaxColorWindow background.
outlineWaxColorWindow outline.
panelWaxColorText boxes, dropdown lists and consoles.
cardWaxColorSection background.
card_lineWaxColorSection outline.
raisedWaxColorButtons and tracks.
hoverWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
pressWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
lineWaxColorSeparators.
textWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
dimWaxColorSecondary text.
accentWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
accent_hoverWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
goodWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
warnWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
badWaxColorA colour in the linear form the engine uses. Make one with ui.Color.
clearWaxColorFully transparent.
on_accentWaxColorText and knobs drawn on top of the accent colour.
font_sizenumber
title_sizenumber
small_sizenumber
spacingnumberGap between controls.
paddingnumber
row_heightnumber
bar_heightnumberHeight of a window's title bar.
nav_widthnumberDefault width of a side navigation column.
window_shapeWaxShape
control_shapeWaxShape
animationnumberSeconds for open, close and expand animations. 0 turns animation off.

WaxThemeSettings

Theme settings to change. Colours may be given as "#RRGGBB" or 0xRRGGBB.

Used by ui.SetTheme, ui.AddTheme.

OptionType
windowWaxColor | string | integer
outlineWaxColor | string | integer
panelWaxColor | string | integer
cardWaxColor | string | integer
card_lineWaxColor | string | integer
raisedWaxColor | string | integer
hoverWaxColor | string | integer
pressWaxColor | string | integer
lineWaxColor | string | integer
textWaxColor | string | integer
dimWaxColor | string | integer
accentWaxColor | string | integer
accent_hoverWaxColor | string | integer
goodWaxColor | string | integer
warnWaxColor | string | integer
badWaxColor | string | integer
clearWaxColor | string | integer
on_accentWaxColor | string | integer
font_sizenumber
title_sizenumber
small_sizenumber
spacingnumber
paddingnumber
row_heightnumber
bar_heightnumber
nav_widthnumber
window_shapeWaxShape
control_shapeWaxShape
animationnumber

WaxWindowOptions

Used by ui.Window.

OptionTypeDescription
titlestring"Window" when omitted.
iconstringIcon name shown before the title. The menu's Icons page lists the names.
widthnumberDefault 340, or 520 with side navigation.
heightnumberDefault 420, or 380 with pages.
xnumber
ynumber
closablebooleanFalse leaves out the close button.
visiblebooleanFalse creates the window hidden.
navWaxNavGives the window pages, listed down the side or along the top.
nav_widthnumberWidth of the side navigation column.
rememberbooleanFalse stops Wax remembering the window's position and size between sessions.

WaxPageOptions

Used by window:Page, ui.Debug.Page.

OptionTypeDescription
iconstringIcon name shown before the page's name. The menu's Icons page lists the names.
bottombooleanLists the page at the bottom of a side navigation column.
scrollbooleanFalse makes a page that does not scroll. Its controls stack from the top, and a Grid or Console with no height takes the space left.

WaxStatusOptions

Used by statusBar:Set.

OptionTypeDescription
kindWaxKindSets the colour of the text and the icon. "info" when omitted.
iconstringIcon name shown before the text. The menu's Icons page lists the names.

WaxOverlayOptions

Used by ui.Overlay.

OptionTypeDescription
anchorWaxAnchorWhere on the screen the panel is pinned. "top-right" when omitted.
xnumberDistance in from the anchor's edge. Default 16.
ynumberDistance in from the anchor's edge. Default 16.
widthnumberDefault 240.
titlestringAdds a heading.
backgroundbooleanFalse leaves out the panel behind the controls.
movablebooleanFalse stops the player dragging it while the menu is open. Where it was dragged to is remembered.

WaxNotifyOptions

Used by ui.Notify.

OptionTypeDescription
titlestringA bold line above the text.
kindWaxKindSets the colour and the icon. "info" when omitted.
iconstringIcon name used in place of the kind's own. The menu's Icons page lists the names.
secondsnumberTime on screen. Default 4, and 0 keeps it until closed.
progressnumber0..1. Shows progress in place of the countdown and keeps the notification until closed.

WaxTagOptions

Used by ui.Tag.

OptionTypeDescription
textstring
colorWaxColor | string
sizenumber
withinnumberMetres. Farther away than this the tag is not shown. Default 100.
liftnumberHow far above the thing's middle the tag sits, in centimetres. Worked out from the thing when omitted.

WaxHotkeyOptions

Used by ui.Hotkey.

OptionTypeDescription
in_menubooleanAlso reacts while the menu is open (off by default, so that typing in a box does not trigger it).

Named values

Short names for a fixed set of values. Where a function asks for one of these, pass one of the values listed.

WaxKind

One of "info", "good", "warn", "bad".

WaxCorner

One of "top-left", "top-right", "bottom-left", "bottom-right".

WaxAnchor

One of "top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right".

WaxNav

One of "side", "top".

WaxFontFamily

One of "ui", "mono", "plain".

WaxThemeName

One of "Midnight", "Graphite", "Abyss", "Dune", "Daylight", or any other string.

WaxShape

One of "frame6", "frame8", "frame12", "top8", "glow12", "glow12_soft", "round2", "round3", "round4", "round5", "round6", "round7", "round8", "round9", "round10", "round12".

On this page

uiui.Open()ui.Close()ui.Toggle()ui.Copy(text)ui.IsOpen()ui.SetPreview(on)ui.IsPreview()ui.SetToggleKey(key)ui.GetToggleKey()ui.Window(options?)ui.Overlay(options?)ui.Tag(target, options?)ui.Notify(text, options?)ui.Windows()ui.Hotkey(key, callback, options?)ui.MinScale()ui.SetScale(scale)ui.GetScale()ui.SetTheme(theme)ui.ResetTheme()ui.Themes()ui.AddTheme(name, colors)ui.ThemeName()ui.Color(hex, alpha?)ui.Theme()ui.AddSettings(container)ui.Notificationsui.Notifications.SetCorner(name)ui.Notifications.SetLimit(count)ui.Notifications.Clear()ui.Notifications.Count()ui.Iconsui.Icons.Names()ui.Icons.Has(name)ui.Icons.Find(text?, limit?)ui.Icons.Register(name, file)ui.Debugui.Debug.Page(name, options?)ui.Debug.Window()ui.Debug.Show()WaxPageWaxWindowwindow:SetTitle(title)window:SetPosition(x, y)window:SetSize(width, height)window:SetNavWidth(width)window:Show()window:Hide()window:SetVisible(shown)window:IsVisible()window:SetMinimized(minimized)window:IsMinimized()window:StatusBar(text?)window:Destroy()window:Page(name, options?)window:RemovePage(page)window:SelectPage(name)WaxStatusBarstatusBar:Set(message?, options?)statusBar:Busy(message?)statusBar:Progress(amount?)statusBar:Right(message?)statusBar:Clear()WaxOverlayoverlay:SetVisible(shown)overlay:IsVisible()overlay:SetAnchor(anchor, x?, y?)overlay:Destroy()WaxNotificationnotification:SetText(text)notification:SetTitle(title)notification:SetProgress(amount)notification:Close()WaxTagtag:Set(text)tag:SetColor(color)tag:SetRange(metres)tag:Remove()WaxHotkeyhotkey.Disconnect()hotkey:SetKey(key)WaxUnknownOptionWaxOptionsWaxColorWaxThemeWaxThemeSettingsWaxWindowOptionsWaxPageOptionsWaxStatusOptionsWaxOverlayOptionsWaxNotifyOptionsWaxTagOptionsWaxHotkeyOptionsNamed valuesWaxKindWaxCornerWaxAnchorWaxNavWaxFontFamilyWaxThemeNameWaxShape