Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- -- Usage: make url name
- if not args[2] then
- print("Usage: "..shell.getRunningProgram().." <url> <path>")
- return
- end
- local url = "http://imgood.us.to/cc/"..args[1]
- local path = args[2]
- local savepath
- if path:find("/") then
- local dir, name = path:match("^(.-/)([^/]+)$")
- savepath = dir .. "_" .. name
- else
- savepath = "_" .. path
- end
- local f = io.open(path, "w")
- f:write([[
- local f1 = http.get("]]..url..[[")
- local f2 = io.open("]]..savepath..[[", "w")
- f2:write(f1.readAll())
- f2:close()
- print("Starting...")
- shell.run("]]..savepath..[[")]])
- f:close()
Add Comment
Please, Sign In to add comment