Difference between revisions of "Term (API)"
From ComputerCraft Wiki
(Undo revision 5328 by Smiley43210 (talk): It does not restore output to the computer if if you redirected more than once.) |
Smiley43210 (Talk | contribs) m (Added types) |
||
Line 5: | Line 5: | ||
{{API table|Term|image=Grid disk.png|2= | {{API table|Term|image=Grid disk.png|2= | ||
− | {{API table/row|[[term.write]](text) | + | {{API table/row|[[term.write]]({{type|string}} text) |
− | |Writes text to the screen.|odd}} | + | |Writes ''text'' to the screen.|odd}} |
{{API table/row|[[term.clear]]() | {{API table/row|[[term.clear]]() | ||
Line 17: | Line 17: | ||
|Returns two arguments containing the x and the y position of the cursor.}} | |Returns two arguments containing the x and the y position of the cursor.}} | ||
− | {{API table/row|[[term.setCursorPos]](x, y) | + | {{API table/row|[[term.setCursorPos]]({{type|int}} x, {{type|int}} y) |
|Sets the cursor's position.|odd}} | |Sets the cursor's position.|odd}} | ||
− | {{API table/row|[[term.setCursorBlink]](bool) | + | {{API table/row|[[term.setCursorBlink]]({{type|boolean}} bool) |
|Disables the blinking or turns it on.}} | |Disables the blinking or turns it on.}} | ||
Line 29: | Line 29: | ||
|Returns two arguments containing the x and the y values stating the size of the screen. (Good for if you're making something to be compatible with both [[Turtle]]s and [[Computer]]s.)}} | |Returns two arguments containing the x and the y values stating the size of the screen. (Good for if you're making something to be compatible with both [[Turtle]]s and [[Computer]]s.)}} | ||
− | {{API table/row|[[term.scroll]](n) | + | {{API table/row|[[term.scroll]]({{type|int}} n) |
|Scrolls the terminal ''n'' lines.|odd}} | |Scrolls the terminal ''n'' lines.|odd}} | ||
Line 38: | Line 38: | ||
|Restores terminal output to the previous target.|odd}} | |Restores terminal output to the previous target.|odd}} | ||
− | {{API table/row|''[[term.setTextColor]]([[Colors (API)|color]])'' | + | {{API table/row|''[[term.setTextColor]]({{type|int}} [[Colors (API)|color]])'' |
|Sets the text color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.}} | |Sets the text color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.}} | ||
− | {{API table/row|''[[term.setBackgroundColor]]([[Colors (API)#Colors|color]])'' | + | {{API table/row|''[[term.setBackgroundColor]]({{type|int}} [[Colors (API)#Colors|color]])'' |
|Sets the background color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.|odd}} | |Sets the background color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.|odd}} | ||
}} | }} | ||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 14:48, 2 May 2013
The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics.
Methods in italics are available only to Advanced Computers and Advanced Monitors.
Term (API) | ||
---|---|---|
Function | Return values | Description |
term.write(string text) | Writes text to the screen. | odd |
term.clear() | Clears the entire screen | |
term.clearLine() | Clears the line the cursor is on | odd |
term.getCursorPos() | Returns two arguments containing the x and the y position of the cursor. | |
term.setCursorPos(int x, int y) | Sets the cursor's position. | odd |
term.setCursorBlink(boolean bool) | Disables the blinking or turns it on. | |
term.isColor() | Returns if the computer supports color. (Used to determine whether or not an Advanced Computer is being used) | odd |
term.getSize() | Returns two arguments containing the x and the y values stating the size of the screen. (Good for if you're making something to be compatible with both Turtles and Computers.) | |
term.scroll(int n) | Scrolls the terminal n lines. | odd |
term.redirect(target) | Redirects terminal output to a monitor or other redirect target. (Use peripheral.wrap to acquire a monitor "object".) | |
term.restore() | Restores terminal output to the previous target. | odd |
term.setTextColor(int color) | Sets the text color of the terminal. Available only to Advanced Computers and Advanced Monitors. | |
term.setBackgroundColor(int color) | Sets the background color of the terminal. Available only to Advanced Computers and Advanced Monitors. | odd |