paintutils.drawLine

Draws a straight line on the current term from the specified start position to the specified end position. Accepts an optional colour argument, which defaults to the term's current background colour.

This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
ExampleWith custom colour
Draws a red line from the top left corner of the current term to the bottom right corner.
Code
<nowiki>
local width, height = term.getSize()
paintutils.drawLine(1, 1, width, height, colours.red)
    </nowiki>
Output

paintutils.drawLine
Function
Syntax
paintutils.drawLine(
  • startX : number
  • startY : number
  • endX : number
  • endX : number
  • colour? : number
)

Returns nil
API paintutils
Source CC:Tweaked (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.