Term (API)
From ComputerCraft Wiki
Revision as of 08:05, 28 March 2014 by Oeed (Talk | contribs) (Moved term.restore in to deprecated table, added term.current, added term_resize event)
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. Methods in bold are available only to Monitors.
Term (API) | ||
---|---|---|
Function | Return values | Description |
term.write(string text) | nil | Writes text to the screen. |
term.clear() | nil | Clears the entire screen |
term.clearLine() | nil | Clears the line the cursor is on |
term.getCursorPos() | number x, number y | Returns two arguments containing the x and the y position of the cursor. |
term.setCursorPos(number x, number y) | nil | Sets the cursor's position. |
term.setCursorBlink(boolean bool) | nil | Disables the blinking or turns it on. |
term.isColor() | boolean | Returns if the computer supports color. (Used to determine whether or not an Advanced Computer is being used) |
term.getSize() | number x, number y | 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(number n) | nil | Scrolls the terminal n lines. |
term.redirect(target) | nil | Redirects terminal output to a monitor or other terminal object. (Use peripheral.wrap to acquire a terminal object.) |
term.current() | table terminal object | Returns the current terminal object. Requires version 1.6 or newer. |
term.setTextColor(number color) | nil | Sets the text color of the terminal. Available only to Advanced Computers and Advanced Monitors. |
term.setBackgroundColor(number color) | nil | Sets the background color of the terminal. Available only to Advanced Computers and Advanced Monitors. |
monitor.setTextScale(number scale) | nil | Sets the text scale on a Monitor. |
Event term_resize | |
Fired when the screen changes size (through opening a new tab with bg, etc). Requires version 1.6 or higher. | |
Returned Object 1 | Nothing |
Deprecated Functions
These functions have been deprecated. These functions have been removed from ComputerCraft .
|
Term (API) | ||
---|---|---|
Function | Return values | Description |
term.restore() | nil | Restores terminal output to the previous target. |