Miticzky

ATM

Jan 20th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. args = {...}
  2. if not args[1] then
  3.   printError("Usage: download <file> [file]")
  4.   return
  5. end
  6. h = http.get("https://raw.github.com/jakemroman/JakeHub/master/"..args[1])
  7. if not h then
  8.   printError("Unknown file")
  9.   return
  10. else
  11.   local prog = h.readAll()
  12.   h.close()
  13.   if not args[2] then
  14.     f = fs.open("/startup","w")
  15.     f.writeLine(prog)
  16.     f.close()
  17.     print("Downloaded.")
  18.   else
  19.     f = fs.open(args[2],"w")
  20.     f.writeLine(prog)
  21.     f.close()
  22.     print("Downloaded as "..args[2])
  23.   end
  24. end
Add Comment
Please, Sign In to add comment