printer.setCursorPos

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function printer.setCursorPos
Sets the cursor position on the page, works the same way as term.setCursorPos().
Syntax printer.setCursorPos(number x, number y)
Returns nil
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Sets the cursor position to the center of the paper and prints "X".
Code
local printer = peripheral.wrap("left")

printer.newPage()

local width, height = printer.getPageSize()

printer.setCursorPos(math.floor(width/2), math.floor(height/2))
printer.write("X")

printer.endPage()
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox