SirBaconBitz

Vendobot Downloader

Jun 30th, 2014
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 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://pastebin.com/raw.php?i=GiqR4v5D",fileloc="startup"},
  7. [2] = {link="http://pastebin.com/raw.php?i=Zmh8exGM",fileloc="foodstuffs"},
  8. [3] = {link="http://pastebin.com/raw.php?i=3EUYtAEx",fileloc="update"},
  9. [4] = {link="http://pastebin.com/raw.php?i=ZV2Ppb7q",fileloc="createrecipe"},
  10. [5] = {link="http://pastebin.com/raw.php?i=FpjkD0fR",fileloc="addfood"},
  11. [6] = {link="http://pastebin.com/raw.php?i=hNtg8cvP",fileloc="menuApi"},
  12. [7] = {link="http://pastebin.com/raw.php?i=myQdJxPV",fileloc="multifood"},
  13. [8] = {link="http://pastebin.com/raw.php?i=U79DxukS",fileloc="search"},
  14. }
  15.  
  16. existing = {}
  17.  
  18. for k,v in pairs(files) do
  19.   if fs.exists(v.fileloc) then
  20.     table.insert(existing, v.fileloc)
  21.   end
  22. end
  23.  
  24. for k,v in pairs(existing) do
  25.   fs.delete(v)
  26. end
  27.  
  28. for k,v in pairs(files) do
  29.   response = http.get(v.link)
  30.   file = response.readAll()
  31.   handle = fs.open(v.fileloc, "w")
  32.   handle.write(file)
  33.   handle.close()
  34. end
  35. os.reboot()
Add Comment
Please, Sign In to add comment