Difference between revisions of "Term.setCursorPos"

From ComputerCraft Wiki
Jump to: navigation, search
(grammar)
 
(3 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=term.setCursorPos
 
|name=term.setCursorPos
|args=[[int]] x, [[int]] y
+
|args={{type|number}} x, {{type|number}} y
 
|returns=none
 
|returns=none
 
|api=term
 
|api=term
Line 8: Line 8:
 
|desc=Sets the location of the cursor on screen.
 
|desc=Sets the location of the cursor on screen.
 
|examples=
 
|examples=
 +
 +
Note that the x and y coordinates cannot be placed between lines. Floating point values (such as 1.5) will be rounded down to integers (like 1, in this case).
 +
 
===Basic usage===
 
===Basic usage===
 
{{Example
 
{{Example
Line 19: Line 22:
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:API_Functions]]

Latest revision as of 10:11, 13 September 2014


Grid Redstone.png  Function term.setCursorPos
Sets the location of the cursor on screen.
Syntax term.setCursorPos(number x, number y)
Returns none
Part of ComputerCraft
API term

Examples

Note that the x and y coordinates cannot be placed between lines. Floating point values (such as 1.5) will be rounded down to integers (like 1, in this case).

Basic usage

Grid paper.png  Example
Sets the location of the cursor on screen to the top
Code
term.setCursorPos(1,1)



Using the old cursor position to affect the new one

Grid paper.png  Example
Sets the location of the cursor to the start of the line.
Code
oldx, oldy = term.getCursorPos()
term.setCursorPos(1,oldy)