Difference between revisions of "Redstone.testBundledInput"

From ComputerCraft Wiki
Jump to: navigation, search
(Corrected mapping from "Boolean" to "Boolean (type)")
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=redstone.testBundledInput
 
|name=redstone.testBundledInput
|args=[[string (type)|string]] side, [[int (type)|int]] color value
+
|args={{type|string}} side, {{type|number}} color value
 
|api=redstone
 
|api=redstone
|returns=[[boolean_(type)|boolean]] true if on, false if off
+
|desc=Checks to see whether the specified color (or ''combined'' color value) is active within a bundled cable input on a given side. Ignores whether other colors are active or not.
 +
|returns={{type|boolean}} true if on, false if off
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Checks whether the blue part of the back input is active
+
|desc=Checks whether the blue part of the back input is active.
|code=[[print]] (redstone.testBundledInput ("back", colors.blue))
+
|code=[[print]](redstone.testBundledInput ("back", colors.blue))
|output=true if the blue part of the back input is active, otherwise false
+
|output=Prints "true" if the blue part of the back input is active, otherwise prints "false".
 +
}}
 +
{{Example
 +
|desc=Checks whether the blue and lime parts of the back input are both active.
 +
|code=[[print]](redstone.testBundledInput ("back", [[colors.combine]](colors.blue, colors.lime)))
 +
|output=Prints "true" if they're both active, otherwise prints "false".
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 00:08, 28 June 2015


Grid Redstone.png  Function redstone.testBundledInput
Checks to see whether the specified color (or combined color value) is active within a bundled cable input on a given side. Ignores whether other colors are active or not.
Syntax redstone.testBundledInput(string side, number color value)
Returns boolean true if on, false if off
Part of ComputerCraft
API redstone

Examples

Grid paper.png  Example
Checks whether the blue part of the back input is active.
Code
print(redstone.testBundledInput ("back", colors.blue))
Output Prints "true" if the blue part of the back input is active, otherwise prints "false".



Grid paper.png  Example
Checks whether the blue and lime parts of the back input are both active.
Code
print(redstone.testBundledInput ("back", colors.combine(colors.blue, colors.lime)))
Output Prints "true" if they're both active, otherwise prints "false".