Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --sys2_modem_recv_wless
- function split(s, delimiter)
- local result = {};
- for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
- table.insert(result, match);
- end
- return result;
- end
- function getMsgData(msg)
- local i, j = string.find(msg, ":")
- local tag = string.sub(msg, 1, i - 1)
- local pts = syslib.split(string.sub(msg, i + 1, -1), ",")
- return tag, pts
- end
- --syslib_end
- rednet.open("top")
- function receiveRednet()
- while true do
- local id, msg = rednet.receive()
- if type(msg) == "string" and string.find(msg, ":") ~= nil then
- return id, msg
- end
- end
- end
- print("modemRecvWLess")
- local modem = peripheral.wrap("back")
- while true do
- local id, msg = receiveRednet()
- if type(msg) == "string" then
- local i, j = string.find(msg, ":")
- local tag = string.sub(msg, 1, i - 1)
- if tag == "@other" then
- msg = string.sub(msg, i + 1, -1)
- print("sending: ",msg)
- modem.transmit(2,3,"<send>:"..id..","..msg)
- elseif tag ~= "<transmitted>" then
- modem.transmit(2, 3, "<transmitted>:" .. id .. "," .. msg)
- end
- end
- end
Add Comment
Please, Sign In to add comment