Difference between revisions of "Rednet.receive"

From ComputerCraft Wiki
Jump to: navigation, search
(its not a table)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=rednet.receive
 
|name=rednet.receive
|args=[[float (type)|float]] timeout
+
|args=[[float (type)|float]] timeoutSeconds
 
|returns=senderId, message, distance-to-sender (or <code>nil</code> if using redpower bundled cable instead of a modem)
 
|returns=senderId, message, distance-to-sender (or <code>nil</code> if using redpower bundled cable instead of a modem)
 
|api=rednet
 
|api=rednet
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Waits till <var>timeout</var> or another computer send a message to this computer. (see [[rednet.broadcast( message )]] and [[rednet.send( receiverID, message )]].<br />To get the id from a computer see  [[os.computerID()]]. In case a Timeout occurs the return id and message are set to nil
+
|desc=Waits for <var>timeoutSeconds</var> or until another computer sends a message to this computer. (see [[rednet.broadcast( message )]] and [[rednet.send( receiverID, message )]].<br />To get the id from a computer see  [[os.computerID()]]. If a Timeout occurs the return id and message are set to nil
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Revision as of 21:06, 25 September 2012


Grid Redstone.png  Function rednet.receive
Waits for timeoutSeconds or until another computer sends a message to this computer. (see rednet.broadcast( message ) and rednet.send( receiverID, message ).
To get the id from a computer see os.computerID(). If a Timeout occurs the return id and message are set to nil
Syntax rednet.receive(float timeoutSeconds)
Returns senderId, message, distance-to-sender (or nil if using redpower bundled cable instead of a modem)
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
waits unlimited till someone sends a message to this computer and displays it
Code
senderId, message, distance = rednet.receive()
term.write(message)
Output The received message.