term.setCursorPos

From ComputerCraft
Jump to: navigation, search

term.setCursorPos
Function
Syntax
term.setCursorPos()
Returns nil
API term
Source CC:Tweaked (source)

Sets the X and Y position of the cursor on the terminal object. The next write on this terminal object will begin from the new cursor position.

ExampleExampleSet cursor pos
Clears the bottom line of the screen with a red colour, and prints "Hello, world!" in white text.
Code
local width, height = term.getSize()

term.setBackgroundColour(colours.red)
term.setTextColour(colours.white)
term.setCursorPos(1, height - 1)
term.clearLine()
term.write("Hello, world!")
Output Demo term.setCursorPos.png