Difference between revisions of "Term.scroll"
From ComputerCraft Wiki
(Added some code examples) |
|||
| (5 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
| − | |||
{{Function | {{Function | ||
|name=term.scroll | |name=term.scroll | ||
| − | |args=n | + | |args={{type|number}} n |
|returns=None | |returns=None | ||
|api=term | |api=term | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
| − | |desc=Scrolls the terminal window. | + | |desc=Scrolls the content on terminal window by the supplied number of lines. |
|examples= | |examples= | ||
| + | {{Example | ||
| + | |desc=Scrolls the text up two lines | ||
| + | |code=[[term.clear]]() | ||
| + | [[term.setCursorPos]](1,10) | ||
| + | print("Hello world!") | ||
| + | -- text exists on the 10th line | ||
| + | term.scroll(2) | ||
| + | -- text is now on the 8th line | ||
}} | }} | ||
| + | {{Example | ||
| + | |desc=Scrolls the text down three lines | ||
| + | |code=[[term.clear]]() | ||
| + | [[term.setCursorPos]](1,3) | ||
| + | print("Hello world!") | ||
| + | -- text exists on the 3rd line | ||
| + | term.scroll(-3) | ||
| + | -- text is now on the 6th line | ||
| + | }} | ||
| + | }} | ||
| + | [[Category:API_Functions]] | ||
Latest revision as of 09:27, 28 October 2013
| Scrolls the content on terminal window by the supplied number of lines. | |
| Syntax | term.scroll(number n) |
| Returns | None |
| Part of | ComputerCraft |
| API | term |
Examples
| Scrolls the text up two lines | |
| Code |
term.clear() term.setCursorPos(1,10) print("Hello world!") -- text exists on the 10th line term.scroll(2) -- text is now on the 8th line |
| Scrolls the text down three lines | |
| Code |
term.clear() term.setCursorPos(1,3) print("Hello world!") -- text exists on the 3rd line term.scroll(-3) -- text is now on the 6th line |