Difference between revisions of "Modem.isOpen"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) m |
MKlegoman357 (Talk | contribs) m (Added 'local modem = peripheral.wrap("top")' to the example) |
||
| Line 9: | Line 9: | ||
{{Example | {{Example | ||
|desc=Checks whether the computer is listening on channel 5. | |desc=Checks whether the computer is listening on channel 5. | ||
| − | |code= | + | |code= local modem = [[peripheral.wrap]]("top") |
| − | + | ||
| − | else | + | if modem.isOpen(5) then |
| − | + | print("The computer is listening on channel 5.") | |
| − | end | + | else |
| + | print("The computer is not listening on channel 5.") | ||
| + | end | ||
|output=Whether or not channel 5 is open. | |output=Whether or not channel 5 is open. | ||
}} | }} | ||
Revision as of 18:18, 8 April 2014
| Checks whether or not a certain channel is open. | |
| Syntax | modem.isOpen(number channel) |
| Returns | boolean is channel open? |
| Part of | ComputerCraft |
| API | Modem |
Examples
| Checks whether the computer is listening on channel 5. | |
| Code |
local modem = peripheral.wrap("top") if modem.isOpen(5) then print("The computer is listening on channel 5.") else print("The computer is not listening on channel 5.") end |
| Output | Whether or not channel 5 is open. |