SirSheepe

Self Updating Program

Jan 10th, 2021 (edited)
221
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. local selfsource = "XEmTmxhk"
  3. local source = "0tWz5PW6"
  4.  
  5. local src0, err0 = http.get("https://pastebin.com/raw/" .. source)
  6. if not src0 then error(err0) end
  7.  
  8. local src1, err1 = http.get("https://pastebin.com/raw/" .. selfsource)
  9. if not src1 then error(err1) end
  10.  
  11. fs.delete("moon.lua")
  12. fs.delete("startup.lua")
  13.  
  14. local file = fs.open("moon.lua", "w")
  15. file.write(src0.readAll())
  16. file.close()
  17. src0.close()
  18.  
  19. file = fs.open("startup.lua", "w")
  20. file.write(src1.readAll())
  21. file.close()
  22. src1.close()
  23.  
  24. shell.run("moon")
RAW Paste Data