Difference between revisions of "Rednet.run"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "{{lowercase}} {{Function |name=rednet.run |api=rednet |returns=Nothing. |addon=ComputerCraft |desc=Automatically started within a co-routine by [[computer...")
 
(Also now handles answers to rednet.lookup() requests.)
 
Line 5: Line 5:
 
|returns=Nothing.
 
|returns=Nothing.
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Automatically started within a [[Coroutine_(type)|co-routine]] by [[computer]]s / [[turtle]]whenever they boot (regardless as to whether they have [[modem]]s available or not), this function constantly waits for [[Modem_message_(event)|modem_message]] events to appear within the event queue and generates corresponding [[Rednet_message_(event)|rednet_message]] events to go with them (which can then be "received" with [[Rednet.receive|rednet.receive()]], or pulled manually with [[Os.pullEvent|os.pullEvent()]]).<br><br>
+
|desc=Automatically started within a [[Coroutine_(type)|co-routine]] by [[bios.lua]] whenever a given system boots (regardless as to whether it has a [[modem]] available or not), this function continues to run in the background and constantly waits for [[Modem_message_(event)|modem_message]] events to appear within the event queue. On spotting them, it then generates corresponding [[Rednet_message_(event)|rednet_message]] events to go with them (which can then be "received" with [[Rednet.receive|rednet.receive()]], or pulled manually with [[Os.pullEvent|os.pullEvent()]]). As of ComputerCraft 1.6, this function also deals with responses to [[rednet.lookup|rednet.lookup()]] requests.<br><br>
  
 
As there need not be multiple instances of this function active, attempting to call it while it's already running (ie ''most any time'') results in an error being thrown ("rednet is already running").
 
As there need not be multiple instances of this function active, attempting to call it while it's already running (ie ''most any time'') results in an error being thrown ("rednet is already running").
Line 15: Line 15:
 
}}
 
}}
 
}}
 
}}
 +
 +
{{RednetAPIFunctions}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Latest revision as of 06:33, 6 June 2014


Grid Redstone.png  Function rednet.run
Automatically started within a co-routine by bios.lua whenever a given system boots (regardless as to whether it has a modem available or not), this function continues to run in the background and constantly waits for modem_message events to appear within the event queue. On spotting them, it then generates corresponding rednet_message events to go with them (which can then be "received" with rednet.receive(), or pulled manually with os.pullEvent()). As of ComputerCraft 1.6, this function also deals with responses to rednet.lookup() requests.

As there need not be multiple instances of this function active, attempting to call it while it's already running (ie most any time) results in an error being thrown ("rednet is already running").
Syntax rednet.run()
Returns Nothing.
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
Attempts to manually start the rednet event listener.
Code
rednet.run()
Output An error stating "rednet is already running" (as this function is started automatically during each computer's / turtle's startup process).


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