Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. id, msg, distance = rednet.receive() -- this covers all paramaters that are fired from rednet receive and now will halt the program till data is received.
  2. print("Received") -- tells user it received data
  3. print("What do you wish to name the file?") -- asks them for a name
  4. term.write("Name: ") -- writes the name then
  5. fileName = tostring(read()) -- allows them to write data which is stored in the variable fileName.
  6. -- Unserializes data so it can be used as a program again
  7. fileContents = textutils.unserialize(msg)
  8. local fileToWrite = fs.open(fileName, "w") -- opens file in write mode
  9. fileToWrite.write(fileContents) -- writes file contents to fileName
  10. fileToWrite.close() -- closes handle
  11. print("Done") -- tells the user it is done
  12. print("File saved as: "..fileName) -- tells the user where the file is saved.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement