Advertisement
Guest User

emailServer.lua

a guest
Aug 3rd, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.42 KB | None | 0 0
  1. function refresh()
  2.    
  3.  
  4. peripheral.find("modem", rednet.open)
  5.  
  6.  
  7. while true do
  8.     h = fs.open("messages.txt", "r")
  9.     repeat
  10.         line = h.readLine()
  11.         if line ~= nil then
  12.             print(line)
  13.         end
  14.     until line == nil
  15.     h.close()
  16.    
  17.    
  18.     id, message = rednet.receive()
  19.     h = fs.open("messages.txt", "a")
  20.     h.writeLine(os.date()..os.time()..";"..message)
  21.     h.close()
  22. end
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement