Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function syncMessages()
- local width, height = term.getSize()
- while true do
- local sender, message = rednet.receive()
- if sender then
- term.setCursorPos(1, height)
- print(message)
- term.write(string.rep("-", width))
- term.scroll(1)
- end
- end
- end
- local function mainLoop()
- local width, height = term.getSize()
- while true do
- term.setCursorPos(1, height)
- term.write(string.rep("-", width))
- term.scroll(1)
- term.setCursorPos(1, height)
- local message = io.read()
- term.setCursorPos(1, height-1)
- print(message)
- rednet.broadcast(message)
- end
- end
- term.clear()
- local modem = peripheral.find("modem")
- if modem then
- rednet.open("back")
- parallel.waitForAny(syncMessages, mainLoop)
- else
- print("Modem not found, no service")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement