Difference between revisions of "Modem.transmit"
From ComputerCraft Wiki
MKlegoman357 (Talk | contribs) m (Expanded) |
Bomb Bloke (Talk | contribs) m |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=''modem''.transmit | |name=''modem''.transmit | ||
− | |args={{type|number}} channel, {{type|number}} replyChannel, {{type| | + | |args={{type|number}} channel, {{type|number}} replyChannel, {{type|any}} message |
|returns={{type|nil}} | |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= 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]] |
Latest revision as of 13:57, 14 June 2015
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
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!") |
Example | |
Sends a table and reply channel over the specified channel. | |
Code |
local modem = peripheral.wrap("top") modem.transmit(1, 2, {"a", "b", "c"}) |