Difference between revisions of "Rednet.receive"
From ComputerCraft Wiki
m (Fixing typo) |
|||
Line 6: | Line 6: | ||
|api=rednet | |api=rednet | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=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()]] | + | |desc=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 |
|examples= | |examples= | ||
{{Example | {{Example |
Revision as of 16:29, 24 March 2012
Function rednet.receive( timeout ) | |
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( timeout )(A number representing the seconds to wait or leave empty to wait unlimited) |
Returns | a tuple where the first value is the sending computers id and the second the message string |
Part of | ComputerCraft |
API | rednet |
Examples
Example | |
waits unlimited till someone sends a message to this computer and displays it | |
Code |
senderId, message = rednet.receive()term.write(message) |