Term (API)
From ComputerCraft Wiki
The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics.
Functions in italics are only available to Monitors. Functions in bold are available only to Windows.
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 whether the terminal supports color. |
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) | table previous terminal object | Redirects terminal output to another terminal object (such as a window or wrapped monitor). Available only to the base term object. |
term.current() | table terminal object | Returns the current terminal object. Requires version 1.6 or newer, available only to the base term object. |
term.native() | table terminal object | Returns the original terminal object. Requires version 1.6 or newer, available only to the base term object. |
term.setTextColor(number color) | nil | Sets the text color of the terminal. Limited functionality without an Advanced Computer / Turtle / Monitor. |
term.setBackgroundColor(number color) | nil | Sets the background color of the terminal. Limited functionality without an Advanced Computer / Turtle / Monitor. |
monitor.setTextScale(number scale) | nil | Sets the text scale. Available only to monitor objects. |
window.setVisible(boolean visibility) | nil | Determines whether subsequent renders to the window will be visible. Available only to window objects. |
window.redraw() | nil | Redraws the contents of the window. Available only to window objects. |
window.restoreCursor() | nil | Returns the cursor back to its position / state within the window. Available only to window objects. |
window.getPosition() | number x, number y | Returns the top left co-ordinate of the window. Available only to window objects. |
window.reposition(number x, number y [, number width, number height]) | nil | Moves and / or resizes the window. Available only to window objects. |
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. Removed by ComputerCraft 1.6. |