Difference between revisions of "Rednet.receive"
From ComputerCraft Wiki
Line 9: | Line 9: | ||
|examples= | |examples= | ||
{{Example | {{Example | ||
− | |desc= | + | |desc=Waits forever until someone sends a message to this computer and displays it. |
|code=senderId, message, distance = rednet.receive()<br>term.write(message) | |code=senderId, message, distance = rednet.receive()<br>term.write(message) | ||
|output=The received message. | |output=The received message. | ||
}} | }} | ||
}} | }} |
Revision as of 15:13, 26 September 2012
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(), or the id command. 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
Example | |
Waits forever until someone sends a message to this computer and displays it. | |
Code |
senderId, message, distance = rednet.receive() |
Output | The received message. |