Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("left")
- modem = peripheral.wrap("right")
- modem.open(1)
- term.redirect(mon)
- todo = {}
- function split(str, pattern)
- local out = {}
- local start = 1
- local splitS, splitE = string.find(str, pattern, start)
- while splitS do
- table.insert(out, string.sub(str, start, splitS-1))
- start = splitE+1
- splitS, splitE = string.find(str, pattern, start)
- end
- table.insert(out, string.sub(str, start))
- return out
- end
- while true do
- --update screen loop
- term.clear()
- term.setCursorPos(1,1)
- if todo then
- for i, item in pairs(todo) do
- print(item)
- end
- end
- --getting messages from pocket computers
- event, mS, sC, rC, message, sD = os.pullEvent("modem_message")
- print("stall")
- args = split(message, " ")
- if args[1] == "add" then table.insert(todo, table.concat(args, " ", 2))
- elseif args[1] == "remove" then
- for i, item in pairs(todo) do
- if item == table.concat(args, " ", 2) then table.remove(todo, i) break end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement