SirBaconBitz

Auto Downloader

Apr 11th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. --[[
  2. All the hipsters have multiple files 'n downloaders 'n shit.
  3. So now I have one too :3
  4. ]]--
  5. local files = {
  6. [1] = {link="http://ccpost.esy.es/ae/files/load.lua",fileloc="startup"},
  7. [2] = {link="http://ccpost.esy.es/ae/files/setup.lua",fileloc="setup"},
  8. [3] = {link="http://ccpost.esy.es/ae/files/functions.lua",fileloc="functions"},
  9. [4] = {link="http://ccpost.esy.es/ae/files/cmd.lua",fileloc="cmd"},
  10. [5] = {link="http://ccpost.esy.es/ae/files/update.lua",fileloc="update"}
  11. }
  12.  
  13. existing = {}
  14.  
  15. for k,v in pairs(files) do
  16.   if fs.exists(v.fileloc) then
  17.     table.insert(existing, v.fileloc)
  18.   end
  19. end
  20.  
  21. for k,v in pairs(existing) do
  22.   fs.delete(v)
  23. end
  24.  
  25. for k,v in pairs(files) do
  26.   response = http.get(v.link)
  27.   file = response.readAll()
  28.   handle = fs.open(v.fileloc, "w")
  29.   handle.write(file)
  30.   handle.close()
  31. end
  32. shell.run("setup")
Add Comment
Please, Sign In to add comment