Knux14

AutoDownloader

Jul 6th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. -- THIS IS A AUTODOWNLOAD TOOL BY KNUX14
  2.    
  3.  
  4.     term.clear()
  5.     term.setCursorPos(1, 1)
  6.      
  7.     function splitString(input, sep)
  8.         if sep == nil then
  9.            sep = "%s"
  10.         end
  11.         t=  {} ; i = 1
  12.         for str in string.gmatch(input, "([^"..sep.."]+)") do
  13.             t[i] = str
  14.             i = i + 1
  15.         end
  16.         return t
  17.     end
  18.      
  19.     m = http.get("http://pastebin.com/raw.php?i=b1N5shQM")
  20.     txt = m.readAll()
  21.     tab = splitString(txt, "_")
  22.      
  23.     tabName = {} ; tabCode = {}
  24.     noDL=true
  25.      
  26.     for i = 0, #tab do
  27.       if i%2 ~= 0 then
  28.         tabName[#tabName + 1] = tab[i]
  29.       else
  30.         tabCode[#tabCode + 1] = tab[i]
  31.       end
  32.     end
  33.      
  34.     for k, v in pairs(tabName) do
  35.       print(k .. "        " .. v)
  36.     end
  37.     print("")
  38.     id = read()
  39.     term.clear()
  40.     term.setCursorPos(1, 1)
  41.     print("Name: ")
  42.     name = read()
  43.     shell.run("pastebin get " .. tabCode[tonumber(id)] .. " " .. name)
Add Comment
Please, Sign In to add comment