Difference between revisions of "Colors.test"

From ComputerCraft Wiki
Jump to: navigation, search
(Create page)
 
m (added a link)
Line 10: Line 10:
 
{{Example
 
{{Example
 
|desc=Combine white, magenta, and light blue, then check if light blue is within the set
 
|desc=Combine white, magenta, and light blue, then check if light blue is within the set
|code=print(colors.test(colors.combine(colors.white, colors.magenta, colours.lightBlue), colors.lightBlue))
+
|code=[[print]](colors.test(colors.combine(colors.white, colors.magenta, colours.lightBlue), colors.lightBlue))
 
|output=true
 
|output=true
 
}}
 
}}
 
}}
 
}}

Revision as of 16:55, 8 July 2012


Grid Redstone.png  Function colors.test
Tests whether color is contained within colors; color may be a single color or may be a set of colors (in the latter case, true is returned only if all colors in color are contained in colors)
Syntax colors.test(int colors, int color)
Returns boolean whether or not all elements of color are contained in the set colors
Part of ComputerCraft
API color

Examples

Grid paper.png  Example
Combine white, magenta, and light blue, then check if light blue is within the set
Code
print(colors.test(colors.combine(colors.white, colors.magenta, colours.lightBlue), colors.lightBlue))
Output true