Guest User

scpd.lua

a guest
Jun 12th, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. function main()
  2.  
  3. peripheral.find("modem", rednet.open)
  4.  
  5. local id, filename, id2, cont
  6.  
  7. --io.stdout:write("waiting..")
  8.  
  9. id, filename = rednet.receive("scp")
  10.  
  11. io.stdout:write("Recieving '" .. filename .. "' from ID " .. id)
  12.  
  13. io.output(filename)
  14.  
  15. while true do
  16.     io.stdout:write(".")
  17.     id2, cont = rednet.receive("scp", 1)
  18.     if id2 then
  19.         if id ~= id2 then
  20.             error("message from other ID interjected")
  21.         end
  22.         break
  23.     end
  24. end
  25.  
  26. io.write(cont)
  27.  
  28. print("\ndone!")
  29. end -- main()
  30.  
  31. print("scpd is running, press Ctrl+T to terminate")
  32. while true do
  33.     main()
  34. end
  35.  
Add Comment
Please, Sign In to add comment