Advertisement
Nullharp

Rednet fileReceive system

May 22nd, 2022 (edited)
42
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("back")
  2.  
  3. local protocol = ""
  4.  
  5. while true do
  6.     id, message = rednet.receive(protocol)
  7.     if message == "RECEIVE" then
  8.         print("Received a file.")
  9.         sleep(0.1)
  10.         id2, message2 = rednet.receive(protocol)
  11.         sleep(0.1)
  12.         local file = fs.open(message2,"w")
  13.         id3, message3 = rednet.receive(protocol)
  14.         print("File name is "..message2)
  15.         sleep(0.1)
  16.         file.write(message3)
  17.         file.close()
  18.         print("Saved File")
  19.     end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement