Difference between revisions of "Term.setCursorPos"
From ComputerCraft Wiki
(Use Talk:Term.setCursorPos) |
|||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=term.setCursorPos | |name=term.setCursorPos | ||
| − | |args= | + | |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 13: | Line 16: | ||
|code=term.setCursorPos(1,1) | |code=term.setCursorPos(1,1) | ||
}} | }} | ||
| − | ===Using the old cursor position to | + | ===Using the old cursor position to affect the new one=== |
{{Example | {{Example | ||
|desc=Sets the location of the cursor to the start of the line. | |desc=Sets the location of the cursor to the start of the line. | ||
| Line 19: | Line 22: | ||
}} | }} | ||
}} | }} | ||
| + | |||
| + | [[Category:API_Functions]] | ||
Latest revision as of 10:11, 13 September 2014
| 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
| 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
| Sets the location of the cursor to the start of the line. | |
| Code |
oldx, oldy = term.getCursorPos() |