View difference between Paste ID: Mb2mMK2G and G2jkR02p
SHOW: | | - or go back to the newest paste.
1-
local m=component.proxy(component.list("modem"))
1+
local m=component.proxy(component.list("modem")(1))
2
m.open(2412)
3
local function respond(...)
4
local args=table.pack(...)
5
pcall(function() m.broadcast(2412, table.unpack(args)) end)
6
end
7
local function receive()
8
while true do
9
local evt,_,_,_,_,cmd=computer.pullSignal()
10
if evt=="modem_message" then return load(cmd) end
11
end
12
end
13
while true do
14
local result,reason=pcall(function()
15
local result,reason=receive()
16
if not result then return respond(reason) end
17
respond(result())
18
end)
19
if not result then respond(reason) end
20
end