Module · Engine client only
ui
Windows, panels and buttons — both your own and the game's. Changing the game's own screens needs the "ui.game" permission, and everything you change is put back when your mod stops.
ui.element(kind: string, options?: any): UiElement
Creates a single element. Options are the same attributes a .uxml file uses.
local b = ui.element("Button", { text = "Go", tooltip = "Start the engine" })ui.find(screen: string, selector: string): UiElement?
Finds a part of one of the game's screens, or nil. Needs the "ui.game" permission to change what it returns.
local play = ui.find("main-menu", "#play-button")
if play then play:setText("Play (modded)") endui.findAll(screen: string, selector: string, limit?: integer): UiElement[]
Every part of one of the game's screens matching a selector.
ui.kinds(): string[]
The kinds of element you can create.
ui.load(path: string): UiElement
Builds the elements described by one of your .uxml files and returns the root. It is not on screen until you add it somewhere.
local tree = ui.load("ui/thrusters.uxml")
ui.panel():add(tree)ui.panel(options?: table): UiElement
Creates a panel of your own on top of the game and returns it.
options(optional): { anchor = "top-left"|"top"|"top-right"|"left"|"center"|"right"|"bottom-left"|"bottom"|"bottom-right", margin, width, height, padding = number, name, class = string, style = table }
local panel = ui.panel{ anchor = "top-right", width = 320, padding = 12 }
panel:addNew("Label", { text = "Hello" })ui.screen(screen: string): UiElement?
The root of one of the game's screens, so you can add to it.
ui.screens(): any
The game's screens a mod may change, and whether each is open right now.
for _, s in ipairs(ui.screens()) do log.info(s.id, s.open) end