Difference between revisions of "Term.isColor"

From ComputerCraft Wiki
Jump to: navigation, search
m (Grammar, we use it.)
m (Added boolean tag)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=term.isColor
 
|name=term.isColor
|returns=Returns true if it's an advanced computer.
+
|returns=[[boolean_(type)|boolean]] returns true if it's an advanced computer.
 
|api=term
 
|api=term
 
|addon=ComputerCraft
 
|addon=ComputerCraft

Revision as of 20:43, 3 June 2013


Grid Redstone.png  Function term.isColor
Returns true if it's an advanced computer.
Syntax term.isColor()
Returns boolean returns true if it's an advanced computer.
Part of ComputerCraft
API term

Examples

Grid paper.png  Example
This program verifies if the computer can display colors.
If it can, the computer clears the screen and changes the background to lime, otherwise, it turns computer off.
Code
local isAdvanced = term.isColor and term.isColor() 
if isAdvanced then
term.setBackgroundColor(colors.lime)
term.clear()
else
os.shutdown()
end