Difference between revisions of "Modem.transmit"

From ComputerCraft Wiki
Jump to: navigation, search
Line 8: Line 8:
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Sends a message and a reply channel over the specified channel.
+
|desc=Sends a {{type|string}} message and a reply channel over the specified channel.
 
|code= local modem = [[peripheral.wrap]]("top")
 
|code= local modem = [[peripheral.wrap]]("top")
 
   
 
   
 
  modem.transmit(1, 2, "Hello world!")
 
  modem.transmit(1, 2, "Hello world!")
 +
}}
 +
 +
{{Example
 +
|desc=Sends a {{type|table}} and reply channel over the specified channel.
 +
|code = local modem = [[peripheral.wrap]]("top")
 +
 +
modem.transmit(1, 2, {"a", "b", "c"})
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Revision as of 18:01, 8 April 2015

Grid Redstone.png  Function modem.transmit
Sends a message and a reply channel over the specified channel. The message may be any type of data excluding functions and threads, which will be received as nil.
Syntax modem.transmit(number channel, number replyChannel, message)
Returns nil
Part of ComputerCraft
API Modem

Examples

Grid paper.png  Example
Sends a string message and a reply channel over the specified channel.
Code
local modem = peripheral.wrap("top")

modem.transmit(1, 2, "Hello world!")




Grid paper.png  Example
Sends a table and reply channel over the specified channel.
Code
local modem = peripheral.wrap("top")

modem.transmit(1, 2, {"a", "b", "c"})