Sharp Aion2 Lua SDK
API reference

gfxLua table

Draw lines, rectangles, and text on the game screen.

Call gfx functions from a loaded module's on_tick callback. Coordinates are screen positions. Colors use 0xAABBGGRR. A script can submit at most 1024 drawings per update.

gfx.line(x1, y1, x2, y2, color, thickness)

Parameters: The two endpoint pairs are screen coordinates, color is packed color, and optional thickness is greater than 0 and at most 32. Returns: No value on success, or nil, error.

gfx.line(20, 20, 120, 20, 0xFFFFFFFF, 2)

gfx.rect(x1, y1, x2, y2, color)

Parameters: The first pair is the upper-left corner, the second is the lower-right corner, and color is packed color. Returns: No value on success, or nil, error.

gfx.rect(20, 30, 120, 80, 0xFF4080C0)

gfx.text(x, y, text, color, size)

Parameters: x and y are screen coordinates; text is at most 512 bytes; color is packed color; optional size is 6–72 (default 16). Returns: No value on success, or nil, error.

function on_tick()
    local level = game.local_level()
    if level then
        gfx.text(20, 80, "Level " .. level, 0xFFFFFFFF, 16)
    end
end