Difference between revisions of "Colors.test"
From ComputerCraft Wiki
m (Corrected mapping from "Boolean" to "Boolean (type)") |
m (Fix wrong API name) |
||
| Line 3: | Line 3: | ||
|name=colors.test | |name=colors.test | ||
|args=[[int (type)|int]] colors, [[int (type)|int]] color | |args=[[int (type)|int]] colors, [[int (type)|int]] color | ||
| − | |api= | + | |api=colors |
|returns=[[boolean_(type)|boolean]] whether or not all elements of <var>color</var> are contained in the set <var>colors</var> | |returns=[[boolean_(type)|boolean]] whether or not all elements of <var>color</var> are contained in the set <var>colors</var> | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
Revision as of 19:46, 21 April 2013
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 | colors |
Examples
| 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 |