Z1maV1

getFiles

May 15th, 2022 (edited)
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. rednet.open("top")
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. write("Enter receive protocol): ")
  7. protocol = read()
  8.  
  9. print("Getting files...")
  10.  
  11. while true do
  12.     id,msg = rednet.receive(protocol)
  13.     if msg == "RECEIVE" then
  14.         id2,msg2 = rednet.receive(protocol)
  15.         f = fs.open(msg2, "w")
  16.         id3,msg3 = rednet.receive(protocol)
  17.         f.write(msg3)
  18.         f.close()
  19.         print("File " ..msg2.. " received!")
  20.         sleep(5)
  21.     end
  22. end
  23.  
  24. term.clear()
  25. term.setCursorPos(1,1)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment