Difference between revisions of "Rednet.send"
From ComputerCraft Wiki
(fixing links) |
Bomb Bloke (Talk | contribs) ("WaitUntilPortOpen" is not currently a valid parameter; suspect it was pre-1.5 behaviour?) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=rednet.send | |name=rednet.send | ||
− | |args={{type|number}} receiverID, {{type|string}} message | + | |args={{type|number}} receiverID, {{type|string}} message |
− | |returns=[[boolean_(type)|boolean]] success code. True if a message has been sent, false if not. | + | |returns=[[boolean_(type)|boolean]] success code. True if a message has been sent (note - "sent", as opposed to "received" or even "was receivable"), false if not. |
|api=rednet | |api=rednet | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc= | + | |desc=Allows a [[computer]] / [[turtle]] with an attached [[modem]] to send a message intended for a system with a specific ID. At least one such modem must first be "opened" with eg [[Rednet.open|rednet.open()]] before sending is possible. Assuming the target was in range and also had a correctly opened modem, it can then use [[rednet.receive|rednet.receive()]] to collect the message. See also [[rednet.broadcast|rednet.broadcast()]].<br><br> |
+ | |||
+ | Note that any systems in range are capable of receiving the message if their owners have some idea what ID you're targeting - they need only use [[Modem.open|modem.open()]] | ||
+ | |||
+ | To get the ID of a given system, refer to [[os.computerID|os.computerID()]]. | ||
|examples= | |examples= | ||
{{Example | {{Example | ||
− | |desc=Sends a | + | |desc=Sends a message to the system with the ID of 22 (assuming a modem is attached and open). |
− | |code=rednet.send(22,"ComputerCraft" | + | |code=rednet.send(22,"ComputerCraft") |
}} | }} | ||
}} | }} | ||
[[Category:API_Functions]] | [[Category:API_Functions]] |
Revision as of 01:00, 24 February 2014
Function rednet.send | |
Allows a computer / turtle with an attached modem to send a message intended for a system with a specific ID. At least one such modem must first be "opened" with eg rednet.open() before sending is possible. Assuming the target was in range and also had a correctly opened modem, it can then use rednet.receive() to collect the message. See also rednet.broadcast(). Note that any systems in range are capable of receiving the message if their owners have some idea what ID you're targeting - they need only use modem.open() To get the ID of a given system, refer to os.computerID(). | |
Syntax | rednet.send(number receiverID, string message) |
Returns | boolean success code. True if a message has been sent (note - "sent", as opposed to "received" or even "was receivable"), false if not. |
Part of | ComputerCraft |
API | rednet |
Examples
Example | |
Sends a message to the system with the ID of 22 (assuming a modem is attached and open). | |
Code |
rednet.send(22,"ComputerCraft") |