Difference between revisions of "Rednet.isOpen"

From ComputerCraft Wiki
Jump to: navigation, search
m (Reverted edits by 199.19.105.156 (talk) to last revision by AfterLifeLochie)
(Parameter optional under CC 1.6.)
 
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=rednet.isOpen
 
|name=rednet.isOpen
|args=[[string]] side
+
|args=[<nowiki/>[[string]] side]
 
|returns=[[boolean_(type)|boolean]] isOpen, if the side has rednet opened it returns true, else false.
 
|returns=[[boolean_(type)|boolean]] isOpen, if the side has rednet opened it returns true, else false.
 
|api=rednet
 
|api=rednet
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Checks to see if the side has rednet opened.
+
|desc=Checks to see if the side's [[modem]] has been [[rednet.open|readied]] for rednet usage. If no side is specified then it returns whether ''any'' side has an open modem, though the parameter is not optional under versions of ComputerCraft prior to 1.6.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc=Checks if any side is opened, if so then tell the user.
 
|desc=Checks if any side is opened, if so then tell the user.
|code=for n,m in ipairs(rs.getSides()) do  
+
|code=for n,m in ipairs([[redstone.getSides|rs.getSides()]]) do  
 
     if rednet.isOpen(m) then  
 
     if rednet.isOpen(m) then  
 
       print(m.." is open!")  
 
       print(m.." is open!")  
Line 19: Line 19:
 
}}
 
}}
 
}}
 
}}
 +
 +
{{RednetAPIFunctions}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Latest revision as of 06:33, 6 June 2014


Grid Redstone.png  Function rednet.isOpen
Checks to see if the side's modem has been readied for rednet usage. If no side is specified then it returns whether any side has an open modem, though the parameter is not optional under versions of ComputerCraft prior to 1.6.
Syntax rednet.isOpen([string side])
Returns boolean isOpen, if the side has rednet opened it returns true, else false.
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
Checks if any side is opened, if so then tell the user.
Code
for n,m in ipairs(rs.getSides()) do 
   if rednet.isOpen(m) then 
     print(m.." is open!") 
   else 
     print(m.." isn't open!") 
   end 
 end


Grid disk.png Rednet API Functions
rednet.open - rednet.close - rednet.send - rednet.broadcast - rednet.receive - rednet.isOpen - rednet.host - rednet.unhost - rednet.lookup