Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ins = "left"
- local out = "bottom"
- rednet.open(ins)
- rednet.open(out)
- -- data coming in formatted as "toId#data"
- while (true) do
- local e, side, chan, repl, msg, dis = os.pullEventRaw("modem_message")
- if (side == ins) then
- local data = string.sub(msg, string.find(msg, "#") + 1)
- local destId = string.sub(msg, 0, string.find(msg, "#") - 1)
- print("routing " .. data .. " from " .. chan .. " to " .. destId)
- peripheral.call(out, "transmit", tonumber(destId), repl, data)
- end
- if (side == out) then
- local data = string.sub(msg, string.find(msg, "#") + 1)
- local destId = string.sub(msg, 0, string.find(msg, "#") - 1)
- print("routing " .. data .. " from " .. chan .. " to " .. destId)
- peripheral.call(ins, "transmit", tonumber(destId), repl, data)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment