Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- local modem = peripheral.wrap("back")
- modem.open(2)
- print("modemSendWire")
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print("received: ", message)
- if type(message) == "string" then
- if string.sub(message, 1, 7) == "<send>:" then
- message = string.sub(message, 8, -1)
- local i = string.find(message, ",")
- local fromId = tonumber(string.sub(message, 1, i - 1))
- message = string.sub(message, i + 1, -1)
- i = string.find(message, ",")
- local toId = tonumber(string.sub(message, 1, i - 1))
- message = string.sub(message, i + 1, -1)
- rednet.send(toId, "<transmitted>:" .. fromId .. "," .. message)
- else
- rednet.broadcast(message)
- end
- else
- for i, j in pairs(message) do
- print(i, ",", j)
- end
- end
- end
Add Comment
Please, Sign In to add comment