Difference between revisions of "Term (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(fix getCursorPos return type)
m (Added NeedsWork note)
Line 1: Line 1:
 +
{{NeedsWork|New 1.6 functions and changes should be added. - [[User:Oeed|Oeed]] 05:58, 28 March 2014 (GMT)}}
 +
 
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.
  

Revision as of 05:58, 28 March 2014

This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: New 1.6 functions and changes should be added. - Oeed 05:58, 28 March 2014 (GMT))

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.

Grid disk.png  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 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.