printer.getCursorPos

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function printer.getCursorPos
Returns the coordinates of the cursor on the paper, works the same way as term.getCursorPos().
Syntax printer.getCursorPos()
Returns number x position of the cursor, number y position of the cursor
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Writes text on the paper and then prints the cursor position.
Code
local printer = peripheral.wrap("left")

printer.newPage()
printer.write("Hello, World!")

local x, y = printer.getCursorPos()
print("The cursor on the paper is on X: " .. x .. " and Y: " .. y)

printer.endPage()
Output The cursor on the paper is on X: 14 and Y: 1
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox