term.isColor

From ComputerCraft Wiki
Revision as of 08:01, 23 January 2013 by Cruor (Talk | contribs) (Removed chance of getting imaginary OCD by code. Fixed example not doing what it says it does.)

Jump to: navigation, search


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

Examples

Grid paper.png  Example
This program verify 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