rednet.receive

From ComputerCraft Wiki
Revision as of 08:01, 30 May 2012 by Pinkishu (Talk | contribs)

Jump to: navigation, search


Grid Redstone.png  Function rednet.receive
Waits till timeout or another computer send a message to this computer. (see rednet.broadcast( message ) and rednet.send( receiverID, message ).
To get the id from a computer see os.computerID(). In case a Timeout occurs the return id and message are set to nil
Syntax rednet.receive(float timeout)
Returns table with 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.