Difference between revisions of "Redstone (API)"
From ComputerCraft Wiki
m (I'm supposed to be on vacation. ~.~) |
TheCoryKid (Talk | contribs) (Added missing methods (rs.getAnalogInput/setAnalogOutput/getAnalogOutput()).) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
The Redstone API contains methods to control attached RedPower cables/bundled cables and regular redstone. | The Redstone API contains methods to control attached RedPower cables/bundled cables and regular redstone. | ||
Line 23: | Line 20: | ||
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getOutput]]({{type|string}} side)</td> | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getOutput]]({{type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone output signal on ''side''</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone output signal on ''side''</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getAnalogInput]]({{type|string}} side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone input signal strength on ''side''. If no input is present, returns 0. If a redstone source (such as a redstone torch or block) is directly adjacent to the computer, returns 15.</td></tr> | ||
+ | |||
+ | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.setAnalogOutput]]({{type|string}} side, {{type|number}} strength)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Set or reset a redstone signal on ''side'' to ''strength''.</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getAnalogOutput]]({{type|string}} side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone output signal strength on ''side''</td></tr> | ||
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getBundledInput]]({{type|string}} side)</td> | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getBundledInput]]({{type|string}} side)</td> |
Revision as of 07:32, 4 May 2013
The Redstone API contains methods to control attached RedPower cables/bundled cables and regular redstone.
Method Name | Description |
redstone.getSides() | Returns a table of possible sides |
redstone.getInput(string side) | Returns the current redstone input signal state on side |
redstone.setOutput(string side, boolean value) | Set or reset a redstone signal on side |
redstone.getOutput(string side) | Returns the current redstone output signal on side |
redstone.getAnalogInput(string side) | Returns the current redstone input signal strength on side. If no input is present, returns 0. If a redstone source (such as a redstone torch or block) is directly adjacent to the computer, returns 15. |
redstone.setAnalogOutput(string side, number strength) | Set or reset a redstone signal on side to strength. |
redstone.getAnalogOutput(string side) | Returns the current redstone output signal strength on side |
redstone.getBundledInput(string side) | Returns the state of a redpower wire inside a bundle connected to side |
redstone.getBundledOutput(string side) | Returns the set of redpower wires inside a bundle on side that are being driven high by the local console (not those that are driven high by another device on the bundle but not driven high by the local console) |
redstone.setBundledOutput(string side, int colors) | Sets one or multiple colored signals in a redpower bundled wire connected to Side. In order to set multiple signals, add the color values of the colors you want to activate. To turn off all of the values, use 0 for the integer. |
redstone.testBundledInput(string side, int color) | Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to side |