Sharp Aion2 Lua SDK
API reference

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

Media

ui.image(id, path, options)

ui.video(id, path, options)

Queue an image or muted video inside an open window. Returns true on successful validation and queueing, or nil,error. Loading and file/codec errors appear in the widget after decoding. Check type(ui.image) and type(ui.video) when supporting older clients.

Paths are relative to Scripts/media, using / between folders, for example logo.png or loops/night.mp4. URLs, absolute paths and parent traversal are rejected. PNG, JPEG and BMP images are supported; animated images show their first frame. H.264 MP4 videos require the corresponding Windows media components.

OptionDefaultValues
width00–4096 logical units; 0 fills the column. Explicit widths are capped to the column.
height1801–4096 logical units.
coverfalsefalse fits the whole image; true crops centrally to fill the rectangle.
tintopaque whitePacked RGBA; alpha controls media opacity.
playingtruePause/resume video.
looptrueRepeat video. If false, retain the final frame. Use a new widget ID to restart it.

Each file is limited to 256 MiB. Frames must fit 2048 pixels per side and 2,073,600 pixels in total, including 1920 × 1080. Eight media widgets can be resident across scripts and the menu. Hidden media pauses and is reclaimed after two seconds without drawing; showing it again after reclamation starts it over. Removing a widget or unloading its module releases its resources after this grace period.

Text 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.

function on_tick()
    local opened, err = ui.begin_window("summary", "Summary", 80, 120, 250, 130)
    if not opened then log.warn(err); return end
    ui.text("Character")
    ui.same_line()
    ui.text_colored("Ready", 0xFF40C080)
    ui.separator()
    ui.end_window()
end

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
    local clicked, buttonError = ui.button("refresh", "Refresh")
    if clicked then log.info("Refresh requested") end
    if clicked == nil then log.warn(buttonError) end
    local nextEnabled, checkboxError = ui.checkbox("enabled", "Enabled", enabled)
    if nextEnabled == nil then log.warn(checkboxError) else enabled = nextEnabled end
    local nextVolume, sliderError = ui.slider_float("volume", "Volume", volume, 0, 1)
    if nextVolume == nil then log.warn(sliderError) else volume = nextVolume end
    local nextName, inputError = ui.input_text("name", "Name", name)
    if nextName == nil then log.warn(inputError) else name = nextName end
    ui.end_window()
end

Script windows remain visible when the main menu closes. Open the menu to interact with their controls.

Charts

ui.chart(id, label, samples, options)

Queues a read-only line or bar chart in the current window and returns true, or nil,error. samples is a copied dense array of 0-512 finite numbers, rendered as 32-bit floats. Sparse/keyed arrays and metatables are rejected. Values and fixed limits are bounded to approximately ±1e30. One chart counts as one widget; the global chart budget is 16,384 samples per frame.

options is optional: type is "line" (default) or "bar"; width is 0 to fill the current column or 80-1200 pixels; height is 40-600 (default 160); color is packed RGBA; grid defaults true. Supply both minimum and maximum for fixed limits, with minimum less than maximum. Otherwise ranges are automatic; bars include zero. Empty charts display No data. Hover shows the one-based sample number and value.

This requires a chart-enabled loaded DLL. Check type(ui.chart)=="function" before using it with an older client.

function on_tick()
    if type(ui.chart) ~= "function" then return end
    local opened, err = ui.begin_window("prices", "Price history", 80, 80, 600, 260)
    if not opened then log.warn(err); return end
    local queued, chartError = ui.chart("price", "Sample prices", {100, 95, 120, 140}, {
        type = "line", height = 160, minimum = 0, maximum = 200,
    })
    if not queued then log.warn(chartError) end
    ui.end_window()
end

On this page