Difference between revisions of "Term (API)"
From ComputerCraft Wiki
m (Paran-spacing.) |
|||
Line 4: | Line 4: | ||
!style="background:#EEE" width="*"|Description | !style="background:#EEE" width="*"|Description | ||
|- | |- | ||
− | |[[term.write|term.write( text )]] | + | |[[term.write|term.write(text)]] |
|Writes text to the screen. | |Writes text to the screen. | ||
|- | |- | ||
Line 16: | Line 16: | ||
|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. | ||
|- | |- | ||
− | |[[Term.setCursorPos|term.setCursorPos( x, y )]] | + | |[[Term.setCursorPos|term.setCursorPos(x, y)]] |
|Sets the cursor's position. | |Sets the cursor's position. | ||
|- | |- | ||
− | |[[Term.setCursorBlink|term.setCursorBlink( b )]] | + | |[[Term.setCursorBlink|term.setCursorBlink(b)]] |
|Disables the blinking or turns it on. | |Disables the blinking or turns it on. | ||
|- | |- | ||
Line 28: | Line 28: | ||
|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 [[Consoles]].) | |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 [[Consoles]].) | ||
|- | |- | ||
− | |[[term.scroll|term.scroll( n )]] | + | |[[term.scroll|term.scroll(n)]] |
|Scrolls the terminal ''n'' lines. | |Scrolls the terminal ''n'' lines. | ||
|- | |- | ||
− | |[[term.redirect|term.redirect( target )]] | + | |[[term.redirect|term.redirect(target)]] |
|Redirects terminal output to a monitor or other redirect target. (Use [[peripheral.wrap]] to acquire a monitor "object".) | |Redirects terminal output to a monitor or other redirect target. (Use [[peripheral.wrap]] to acquire a monitor "object".) | ||
|- | |- | ||
Line 37: | Line 37: | ||
|Restores terminal output to the previous target. | |Restores terminal output to the previous target. | ||
|- | |- | ||
− | |[[term.setTextColor|term.setTextColor]]( [[Colors#Colors|color]] ) | + | |[[term.setTextColor|term.setTextColor]]([[Colors#Colors|color]]) |
|Sets the foreground color for text subsequently written to the terminal. '''Note:''' only available on [[Advanced Computer|Advanced Computers]]. | |Sets the foreground color for text subsequently written to the terminal. '''Note:''' only available on [[Advanced Computer|Advanced Computers]]. | ||
|- | |- | ||
− | |[[term.setBackgroundColor]]( [[Colors#Colors|color]] ) | + | |[[term.setBackgroundColor]]([[Colors#Colors|color]]) |
|Sets the background color for text subsequently written to the terminal. '''Note:''' only available on [[Advanced Computer|Advanced Computers]]. | |Sets the background color for text subsequently written to the terminal. '''Note:''' only available on [[Advanced Computer|Advanced Computers]]. | ||
|- | |- | ||
|} | |} | ||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 10:17, 24 November 2012
The Terminal API provides functions for ASCII graphics.
Method name | Description |
---|---|
term.write(text) | Writes text to the screen. |
term.clear() | Clears the entire screen |
term.clearLine() | Clears the line the cursor is on |
term.getCursorPos() | Returns two arguments containing the x and the y position of the cursor. |
term.setCursorPos(x, y) | Sets the cursor's position. |
term.setCursorBlink(b) | 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) |
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 Consoles.) |
term.scroll(n) | Scrolls the terminal n lines. |
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. |
term.setTextColor(color) | Sets the foreground color for text subsequently written to the terminal. Note: only available on Advanced Computers. |
term.setBackgroundColor(color) | Sets the background color for text subsequently written to the terminal. Note: only available on Advanced Computers. |