Difference between revisions of "Modem.transmit"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "{{Function |name=modem.transmit |args={{type|int}} channel, {{type|int}} replyChannel, {{type|string}} message |api=Modem |addon=ComputerCraft |desc=Sends a message and a repl...")
 
m
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Function
 
{{Function
|name=modem.transmit
+
|name=''modem''.transmit
|args={{type|int}} channel, {{type|int}} replyChannel, {{type|string}} message
+
|args={{type|number}} channel, {{type|number}} replyChannel, {{type|any}} message
 +
|returns={{type|nil}}
 
|api=Modem
 
|api=Modem
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Sends a message and a reply channel over the specified channel.
+
|desc=Sends a message and a reply channel over the specified channel. The message may be any type of data excluding {{type|function}}s and {{type|thread}}s, which will be received as {{type|nil}}. Prior to about CC 1.53, {{type|table}}s were also received as nil.
 
|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=modem.transmit(1, 2, "Hello world!")
+
|code= local modem = [[peripheral.wrap]]("top")
 +
 +
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]]

Latest revision as of 13:57, 14 June 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. Prior to about CC 1.53, tables were also received as nil.
Syntax modem.transmit(number channel, number replyChannel, any 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"})