Difference between revisions of "Term (API)"
From ComputerCraft Wiki
m (Added NeedsWork note) |
(Moved term.restore in to deprecated table, added term.current, added term_resize event) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics. | The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics. | ||
Line 36: | Line 34: | ||
{{API table/row|[[term.redirect]](target)|{{type|nil}} | {{API table/row|[[term.redirect]](target)|{{type|nil}} | ||
− | |Redirects terminal output to a monitor or other | + | |Redirects terminal output to a monitor or other terminal object. (Use [[peripheral.wrap]] to acquire a terminal object.)}} |
− | {{API table/row|[[term. | + | {{API table/row|[[term.current]]()|{{type|table}} terminal object |
− | | | + | |Returns the current terminal object. ''Requires version 1.6 or newer.''|odd}} |
{{API table/row|''[[term.setTextColor]]({{type|number}} [[Colors (API)|color]])''|{{type|nil}} | {{API table/row|''[[term.setTextColor]]({{type|number}} [[Colors (API)|color]])''|{{type|nil}} | ||
Line 50: | Line 48: | ||
|Sets the text scale on a [[Monitor]].}} | |Sets the text scale on a [[Monitor]].}} | ||
+ | }} | ||
+ | {{Event | ||
+ | |name=term_resize | ||
+ | |desc=Fired when the screen changes size (through opening a new tab with ''bg'', etc). ''Requires version 1.6 or higher.'' | ||
}} | }} | ||
+ | = Deprecated Functions = | ||
+ | {{Deprecated | ||
+ | |plural=yes | ||
+ | |type=These functions | ||
+ | }} | ||
+ | |||
+ | {{API table|Term|image=Grid disk.png|2= | ||
+ | |||
+ | {{API table/row|[[term.restore]]()|{{type|nil}} | ||
+ | |Restores terminal output to the previous target.|odd}} | ||
+ | |||
+ | }} | ||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 08:05, 28 March 2014
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. |