printer.setCursorPos

From ComputerCraft Wiki
Revision as of 18:58, 9 April 2014 by MKlegoman357 (Talk | contribs) (Expanded)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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()