Difference between revisions of "Redstone (API)"
From ComputerCraft Wiki
m (Changed "int" to "int (type)") |
(Updated to API overview v2) |
||
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. | ||
− | == | + | <table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> |
+ | <tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;"> | ||
+ | [[File:Grid_disk.png|24px]] | ||
+ | Redstone (API) | ||
+ | </td></tr> | ||
+ | |||
+ | <tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | ||
+ | |||
+ | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getSides]]()</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns an array of possible sides</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getInput]]([[string (type)|string]] side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone input signal state on ''side''</td></tr> | ||
+ | |||
+ | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.setOutput]]([[string (type)|string]] side, [[boolean (type)|boolean]] value)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Set or reset a redstone signal on ''side''</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getOutput]]([[string (type)|string]] side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the current redstone output signal on ''side''</td></tr> | ||
+ | |||
+ | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getBundledInput]]([[string (type)|string]] side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the state of a redpower wire inside a bundle connected to ''side''</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.getBundledOutput]]([[string (type)|string]] side)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the set of redpower wires inside a bundle on ''side'' that are being driven high <b>by the local console</b> (not those that are driven high by another device on the bundle but not driven high by the local console)</td></tr> | ||
+ | |||
+ | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.setBundledOutput]]([[string (type)|string]] side, [[int (type)|int]] colors)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">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.</td></tr> | ||
+ | |||
+ | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[redstone.testBundledInput]]([[string (type)|string]] side, [[int (type)|int]] color)</td> | ||
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to ''Side''</td></tr> | ||
+ | |||
+ | </table> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 22:32, 30 November 2012
The Redstone API contains methods to control attached RedPower cables/bundled cables and regular redstone.
Method Name | Description |
redstone.getSides() | Returns an array 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.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 |