FANDOM


line( x0, y0, x1, y1, [col] )

Draws a line between two points.

x0
The x coordinate of the start of the line.
y0
The y coordinate of the start of the line.
x1
The x coordinate of the end of the line.
y1
The y coordinate of the end of the line.
col
The color of the line. If omitted, the color from the draw state is used.

Examples Edit

-- draw a red diamond shape
line(63, 0, 126, 63, 8)
line(126, 63, 63, 126, 8)
line(63, 126, 0, 63, 8)
line(0, 63, 63, 0, 8)
 
-- draw 20 white lines in random locations
color(7)
for x=1,20 do
  line(rnd(128), rnd(128), rnd(128), rnd(128))
end
Line-example-1
Line-example-2

See also Edit