Difference between revisions of "Term (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m (Edit function diescription)
(Undo revision 5328 by Smiley43210 (talk): It does not restore output to the computer if if you redirected more than once.)
Line 36: Line 36:
  
 
{{API table/row|[[term.restore]]()
 
{{API table/row|[[term.restore]]()
|Restores terminal output to the computer.|odd}}
+
|Restores terminal output to the previous target.|odd}}
  
 
{{API table/row|''[[term.setTextColor]]([[Colors (API)|color]])''
 
{{API table/row|''[[term.setTextColor]]([[Colors (API)|color]])''

Revision as of 10:24, 12 April 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.

Grid disk.png  Term (API)
Function Return values Description
term.write(text) Writes text to the screen. odd
term.clear() Clears the entire screen
term.clearLine() Clears the line the cursor is on odd
term.getCursorPos() Returns two arguments containing the x and the y position of the cursor.
term.setCursorPos(x, y) Sets the cursor's position. odd
term.setCursorBlink(bool) 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) odd
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 Computers.)
term.scroll(n) Scrolls the terminal n lines. odd
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. odd
term.setTextColor(color) Sets the text color of the terminal. Available only to Advanced Computers and Advanced Monitors.
term.setBackgroundColor(color) Sets the background color of the terminal. Available only to Advanced Computers and Advanced Monitors. odd