uiLua table
Build interactive Lua windows and controls.
The ui table draws script windows from a loaded module's on_tick callback. Put controls between ui.begin_window and ui.end_window. The ui_sdk helper handles that pair for you.
IDs use 1–64 letters, digits, _, or -. A module can show up to 8 windows and 128 controls, with at most 1024 UI commands per tick. Interaction results arrive on a later tick. Keep each control's prior value and pass it again at the next update.
Windows
ui.begin_window(id, title, x, y, width, height, style)
Parameters: id uniquely identifies this module's window; title is visible text; x, y, width, and height set its initial geometry in menu-scaled units. style is optional. Returns: true or nil, error. Windows cannot nest.
style accepts opacity (0.1–1.0), window_rounding and button_rounding (0–32), show_minimize_button, show_close_button, and packed color overrides such as background, text, and button. Users can drag and resize windows.
ui.end_window()
Parameters: None. Returns: true or nil, error. Call it once after a successful begin_window.
function on_tick()
local opened, err = ui.begin_window("status", "Status", 80, 120, 250, 130)
if not opened then log.warn(err); return end
ui.text("Hello")
ui.end_window()
endText and layout
ui.text(message)
Parameters: message is text to show. Returns: No value on success, or nil, error.
ui.text_colored(message, color)
Parameters: message is text; color is packed 0xAABBGGRR. Returns: No value on success, or nil, error.
ui.separator()
Parameters: None. Returns: No value on success, or nil, error. Adds a divider.
ui.same_line()
Parameters: None. Returns: No value on success, or nil, error. Places the next control on the current row.
ui.text("Character")
ui.same_line()
ui.text_colored("Ready", 0xFF40C080)
ui.separator()Controls
Widget IDs are unique within their window.
ui.button(id, label)
Parameters: id is the widget ID and label is the visible text. Returns: true once when clicked, false otherwise, or nil, error.
ui.checkbox(id, label, value)
Parameters: value is the previous boolean value. Returns: The current boolean or nil, error.
ui.slider_float(id, label, value, minimum, maximum)
Parameters: value is the previous number; increasing bounds must stay within -100000 to 100000. Returns: The current number or nil, error.
ui.input_text(id, label, value)
Parameters: value is the previous text. Returns: Edited text up to 256 bytes, or nil, error. Current typing accepts ASCII.
local enabled, volume, name = false, 0.5, ""
function on_tick()
local opened, err = ui.begin_window("settings", "Settings", 80, 120, 300, 210)
if not opened then log.warn(err); return end
if ui.button("refresh", "Refresh") then log.info("Refresh requested") end
enabled = ui.checkbox("enabled", "Enabled", enabled)
volume = ui.slider_float("volume", "Volume", volume, 0, 1)
name = ui.input_text("name", "Name", name)
ui.end_window()
endScript windows remain visible when the main menu closes. Open the menu to interact with their controls.