Advertisement
Guest User

dispatch2

a guest
Jun 25th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. local args = {...}
  2.  
  3. --if not(fs.exists("robtable")) then
  4. --  print("getting robtable")
  5.   shell.run("delete robtable")
  6.   shell.run("pastebin get qkYQD8xT robtable")
  7. --end
  8. os.loadAPI("robtable")
  9.  
  10. local files = {}
  11. local POSSIBLE_FILES = {frame1 = "6his7eC3", frame2 = "tU7KX1c0", frame3 = "qJ8SssBS", frame4 = "6FmdhQBU", frame5 = "Uezue0GT"}
  12. local FILES_DIR_NAME = "RobMessagingTest"
  13.  
  14. --download all pastebin files if they don't exist. put them in RobMessagingTest
  15. function fetchRequiredFiles(deleteOld)
  16.     print("Fetching files...")
  17.     for key, item in pairs(files) do
  18.    
  19.       _filePath = FILES_DIR_NAME .. "/" .. item
  20.    
  21.       if deleteOld and fs.exists(_filePath) then
  22.         shell.run("delete " .. _filePath)
  23.       end
  24.      
  25.       if not fs.exists(_filePath) then
  26.         print("getting "..item)
  27.         shell.run("pastebin get " .. item .. " " .. _filePath)
  28.       end
  29.      
  30.     end
  31. end
  32.  
  33. function addRequested()
  34.     --table.insert(files, POSSIBLE_FILES.frame1)
  35.   for _, v in args do
  36.     table.insert(files, POSSIBLE_FILES.v)
  37.   end
  38. end
  39.  
  40. if #args == 0 then
  41.   print("Must specify program names to fetch in arguments.\nPossible names:\n---------------")
  42.   local _tempString = ""
  43.   for k, _ in pairs(POSSIBLE_FILES) do
  44.     _tempString = _tempString .. k .. "\t"
  45.   end
  46.   print(_tempString)
  47.   --robtable.printKV(POSSIBLE_FILES,false)
  48. else
  49.   print("Used arguments:")
  50.   robtable.printKV(args)
  51.   print("Getting programs requested in args...")
  52.   addRequested()
  53.   robtable.printKV(files)
  54.   fetchRequiredFiles(false)
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement