Skip to content

drawLine

Draws a single straight line segment between two defined coordinates.

ui.drawLine(p1, p2, color, thickness)

This function renders a line segment starting at p1 and ending at p2. It is useful for creating custom dividers, connecting points in a graph, or drawing custom wireframe shapes.

ParameterTypeRequiredDefaultDescription
p1vec2Yes-The starting screen coordinates.
p2vec2Yes-The ending screen coordinates.
colorrgbmYes-The color and opacity of the line.
thicknessnumberNo1.0The width of the line in pixels.
  • None

Draw a horizontal white line to act as a separator.

local p1 = vec2(10, 50)
local p2 = vec2(200, 50)
local white = rgbm.colors.white
-- draw a 1px thick horizontal line
ui.drawLine(p1, p2, white)