Advertisement
kssr3951

computercannon_installer

Jul 25th, 2014
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. local REQUIRED_FILES =
  2. {
  3.   { name = "Items"         , pastebinCode = "0geLX5MP" },
  4.   { name = "computercannon", pastebinCode = "w5X5WRTE" },
  5. }
  6. local files = { }
  7. for _, val in ipairs(REQUIRED_FILES) do
  8.   if fs.exists(val.name) then
  9.     table.insert(files, val.name)
  10.   end
  11. end
  12. if 0 < #files then
  13.   for _, val in ipairs(files) do
  14.     print(val)
  15.   end
  16.   print(tostring(#files) .. " file(s) exists.")
  17.   print("overwrite? (y/n)")
  18.   local ch = read()
  19.   if ch ~= "y" then
  20.     print("Installation was canceled.")
  21.     return
  22.   end  
  23.   for _, val in ipairs(files) do
  24.     fs.delete(val)
  25.   end
  26. end
  27. print("Installing...")
  28. for _, val in ipairs(REQUIRED_FILES) do
  29.   shell.run("pastebin get " .. val.pastebinCode .. " " .. val.name)
  30. end
  31. print("Installation was completed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement