Difference between revisions of "Term (API)"
From ComputerCraft Wiki
(Added monitor.setTextScale() to the list, seeing as it's techincally a term API function.) |
(Added return types) |
||
Line 6: | Line 6: | ||
{{API table|Term|image=Grid disk.png|2= | {{API table|Term|image=Grid disk.png|2= | ||
− | {{API table/row|[[term.write]]({{type|string}} text) | + | {{API table/row|[[term.write]]({{type|string}} text)|{{type|nil}} |
|Writes ''text'' to the screen.|odd}} | |Writes ''text'' to the screen.|odd}} | ||
− | {{API table/row|[[term.clear]]() | + | {{API table/row|[[term.clear]]()|{{type|nil}} |
|Clears the entire screen}} | |Clears the entire screen}} | ||
− | {{API table/row|[[term.clearLine]]() | + | {{API table/row|[[term.clearLine]]()|{{type|nil}} |
|Clears the line the cursor is on|odd}} | |Clears the line the cursor is on|odd}} | ||
− | {{API table/row|[[term.getCursorPos]]() | + | {{API table/row|[[term.getCursorPos]]()|{{type|nil}} |
|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]]({{type|number}} x, {{type|number}} y) | + | {{API table/row|[[term.setCursorPos]]({{type|number}} x, {{type|number}} y)|{{type|nil}} |
|Sets the cursor's position.|odd}} | |Sets the cursor's position.|odd}} | ||
− | {{API table/row|[[term.setCursorBlink]]({{type|boolean}} bool) | + | {{API table/row|[[term.setCursorBlink]]({{type|boolean}} bool)|{{type|nil}} |
|Disables the blinking or turns it on.}} | |Disables the blinking or turns it on.}} | ||
− | {{API table/row|[[term.isColor]]() | + | {{API table/row|[[term.isColor]]()|{{type|boolean}} |
|Returns if the computer supports color. (Used to determine whether or not an [[Advanced Computer]] is being used)|odd}} | |Returns if the computer supports color. (Used to determine whether or not an [[Advanced Computer]] is being used)|odd}} | ||
− | {{API table/row|[[term.getSize]]() | + | {{API table/row|[[term.getSize]]()|{{type|number}} x, {{type|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 [[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]]({{type|number}} n) | + | {{API table/row|[[term.scroll]]({{type|number}} n)|{{type|nil}} |
|Scrolls the terminal ''n'' lines.|odd}} | |Scrolls the terminal ''n'' lines.|odd}} | ||
− | {{API table/row|[[term.redirect]](target) | + | {{API table/row|[[term.redirect]](target)|{{type|nil}} |
|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".)}} | ||
− | {{API table/row|[[term.restore]]() | + | {{API table/row|[[term.restore]]()|{{type|nil}} |
|Restores terminal output to the previous target.|odd}} | |Restores terminal output to the previous target.|odd}} | ||
− | {{API table/row|''[[term.setTextColor]]({{type|number}} [[Colors (API)|color]])'' | + | {{API table/row|''[[term.setTextColor]]({{type|number}} [[Colors (API)|color]])''|{{type|nil}} |
|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]]({{type|number}} [[Colors (API)#Colors|color]])'' | + | {{API table/row|''[[term.setBackgroundColor]]({{type|number}} [[Colors (API)#Colors|color]])''|{{type|nil}} |
|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}} | ||
− | {{API table/row|'''[[monitor.setTextScale]]({{type|number}} scale)''' | + | {{API table/row|'''[[monitor.setTextScale]]({{type|number}} scale)'''|{{type|nil}} |
|Sets the text scale on a [[Monitor]].}} | |Sets the text scale on a [[Monitor]].}} | ||
Revision as of 02:43, 25 August 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. 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() | nil | 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 redirect target. (Use peripheral.wrap to acquire a monitor "object".) |
term.restore() | nil | Restores terminal output to the previous target. |
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. |