Coming soon toSteam
Modding docsAPI 1

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

client only

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?

client only

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)") end

ui.findAll(screen: string, selector: string, limit?: integer): UiElement[]

client only

Every part of one of the game's screens matching a selector.

ui.kinds(): string[]

client only

The kinds of element you can create.

ui.load(path: string): UiElement

client only

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

client only

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?

client only

The root of one of the game's screens, so you can add to it.

ui.screens(): any

client only

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