Difference between revisions of "Colors.subtract"

From ComputerCraft Wiki
Jump to: navigation, search
m (Fix wrong API name)
(Make description match API table, use type template)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=colors.subtract
 
|name=colors.subtract
|args=[[int (type)|int]] colors, [[int (type)|int]] color1, [[int (type)|int]] color2, …
+
|args={{Type|int}} colors, {{Type|int}} color1, {{Type|int}} color2, …
 
|api=colors
 
|api=colors
|returns=[[int (type)|int]] the set <var>colors</var> after removing sets <var>color1</var>, <var>color2</var>, …
+
|returns={{Type|int}} the set <var>colors</var> after removing sets <var>color1</var>, <var>color2</var>, …
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Computes the difference of a set by removing colors from it; each parameter beyond the first may be a single color or may be a set of colors (in the latter case, all colors in the set are removed from the original set)
+
|desc=Removes one or more colors (or sets of colors) from an initial set; each parameter beyond the first may be a single color or may be a set of colors (in the latter case, all colors in the set are removed from the original set).
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Revision as of 14:23, 22 April 2013


Grid Redstone.png  Function colors.subtract
Removes one or more colors (or sets of colors) from an initial set; each parameter beyond the first may be a single color or may be a set of colors (in the latter case, all colors in the set are removed from the original set).
Syntax colors.subtract(int colors, int color1, int color2, …)
Returns int the set colors after removing sets color1, color2, …
Part of ComputerCraft
API colors

Examples

Grid paper.png  Example
Beginning with white, magenta, and light blue, remove magenta to yield 9 (the bitwise combination of white and light blue)
Code
print(colors.subtract(colors.combine(colors.white, colors.magenta, colours.lightBlue), colors.magenta))
Output 9