Difference between revisions of "Term.isColor"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "{{lowercase}} {{Function |name=term.isColor |returns=If the computer can display colors. |api=term |addon=ComputerCraft |desc=Returns if the computer can display colors. |exam...")
 
(Fix example)
Line 8: Line 8:
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=This program verify if the computer can display colors. <br />If it can,the computer set the background lime,else,it stops the computer.
+
|desc=This program verify if the computer can display colors. <br />If it can, the computer set the background lime, otherwise, it shutdowns the computer.
|code=local advanced = term.isColor() <br />If advanced == 1 then <br />term.setBackgroundColor(colors.lime)<br />term.clear()<br />else<br />os.shutdown<br />end
+
|code=local advanced = term.isColor() <br />if advanced == true then <br />term.setBackgroundColor(colors.lime)<br />else<br />os.shutdown()<br />end
 
}}
 
}}
 
}}
 
}}

Revision as of 07:56, 11 November 2012


Grid Redstone.png  Function term.isColor
Returns if the computer can display colors.
Syntax term.isColor()
Returns If the computer can display colors.
Part of ComputerCraft
API term

Examples

Grid paper.png  Example
This program verify if the computer can display colors.
If it can, the computer set the background lime, otherwise, it shutdowns the computer.
Code
local advanced = term.isColor() 
if advanced == true then
term.setBackgroundColor(colors.lime)
else
os.shutdown()
end