drawLine
Draws a single straight line segment between two defined coordinates.
Signature
Section titled “Signature”ui.drawLine(p1, p2, color, thickness)Description
Section titled “Description”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.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
p1 | vec2 | Yes | - | The starting screen coordinates. |
p2 | vec2 | Yes | - | The ending screen coordinates. |
color | rgbm | Yes | - | The color and opacity of the line. |
thickness | number | No | 1.0 | The width of the line in pixels. |
Return Values
Section titled “Return Values”- None
Examples
Section titled “Examples”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 lineui.drawLine(p1, p2, white)