Advertisement
natie3

update

Oct 15th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. args = {...}
  2. if not fs.exists("programs.lua") then
  3.   shell.run("pastebin get JNFHN32v programs.lua")
  4.   if args[1] == nil then
  5.     error() -- to exit the program to prevent downloading programs twice
  6.   end
  7. end
  8. os.loadAPI("programs.lua")
  9.  
  10. function update(prog)
  11.   if fs.exists(prog .. ".lua") then
  12.     fs.delete(prog .. ".lua")
  13.   end
  14.   shell.run("pastebin get " .. programs.mapping[prog] .. " " .. prog .. ".lua")
  15. end
  16.  
  17. if args[1] == nil then
  18.   update("programs")
  19. elseif args[1] == "all" then
  20.   update("programs")
  21.   for key, value in pairs(programs.mapping) do
  22.     if key ~= "programs" then
  23.       update(key)
  24.     end
  25.   end
  26. else
  27.   update(args[1])
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement