Interface

Menu controls

Create tabs, groups and controls (checkboxes, sliders, combos, color pickers) for your script.

Controls are placed with a path page>group: lua>name is a group in the elements sub tab of the Lua tab, movement>bunnyhop & strafe adds to an existing Luna group with that title, and aim>my group creates a new group on a Luna page. Pages: movement, aim, visuals, hud, misc, inventory, settings, cloud.

FunctionParametersReturnsDescription
ui.Group(name or path)groupui.Tab(name).Group(name), ui.Page(page).Group(name); ui.Checkbox(...) etc. directly use a group named after the script.
group.Checkbox(label, default)controlMembers work with a dot or a colon.
group.SliderInt(label, min, max, default, format?)controlSliderFloat too.
group.Combo(label, items, default)0-based indexcontrolMultiCombo(label, items, defaults), ListBox(label, items, rows)
group.ColorPicker(label, Color or r, g, b, a)control
group.Hotkey(label, key, mode)mode: hold, toggle, alwayscontrolget() tells whether it is active, get_key() returns the key.
group.TextInput(label, default)control
group.Button(label, on_click)control
group.Label(text)controlDivider(text?)
group.ExpandableGroup(label, default)group + checkboxChildren show only while it is ticked.
group.Custom(label, height, fn)fn(x0, y0, x1, y1, control)controlDraw freely in a row with render.*.
control:get()valueset(...), on_change(fn), set_visible(bool), set_label(text), set_items(list), set_range(min, max), remove()

A label can be {id = "enabled", label = "Enabled"} so the saved value survives a rename.

local group = ui.Group("my script")
local enabled = group.Checkbox("enabled", true)
local fov = group.SliderFloat("fov", 1, 30, 15, "%.1f")
local tint = group.ColorPicker("color", Color(255, 0, 0))
local key = group.Hotkey("aim key", 0x05, "hold")
local mode = group.Combo("mode", {"closest", "lowest hp"}, 0)

fov:on_change(function(value)
    print("fov is now", value)
end)

events.present_queue:add(function()
    if enabled:get() and key:get() then
        render.text(20, 20, "active, mode " .. mode:get(), tint:get())
    end
end)
local extra = ui.Group("movement>bunnyhop & strafe")
extra.Checkbox("lua: duck in air", false)

local page = ui.Page("visuals").Group("lua extras")
page.Checkbox("show watermark", true)

gui.* builds controls the other way round: create a control (gui.Checkbox(id), gui.Slider(id, min, max, fmt), gui.ComboBox(id) with combo:add(gui.Selectable(id, text)), gui.ColorPicker, gui.Hotkey, gui.TextInput, gui.Button, gui.Label, gui.List), wrap it with gui.MakeControl(label, control) (or gui.MakeControlEasy(id, label, type)) and add it to a container from gui.ctx:find(path). Read values with control:get_value():get(). Combo boxes return bit sets (get(i), set(i), get_raw()). gui.LuaControl(id, proto, pos, size) makes a custom control whose onRender, onMouseDown and onMouseUp you write.