Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local thread = require("thread")
- local term = require("term")
- local gpu = component.gpu
- local modem = component.modem
- local computer = component.computer
- modem.open(69)
- term.clear()
- --term.write("Chat v1.0\n")
- --term.write("\n#############################\n")
- local vCursor = 4
- local t = thread.create(function()
- while true do
- local _, _, _, _, _, message = event.pull("modem_message")
- print(message)
- end
- end)
- while true do
- term.setCursor(1,1)
- term.write("Chat v1.0\n")
- local input = term.read()
- if input ~= "\n" then
- computer.beep()
- term.setCursor(1,2)
- term.clearLine()
- term.setCursor(1,vCursor)
- term.write("You: "..input)
- local w,h = term.getViewport()
- if vCursor < h-1 then
- vCursor = vCursor + 1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement