Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- files = {
- {
- file = "touchpoint",
- pastebin = "pFHeia96",
- friendly = "Touch Point",
- side={"pocket","computer"}
- },
- {
- file = "ender",
- pastebin = "V91n5SXC",
- friendly = "Ender CC"
- },
- {
- file = "controller",
- pastebin = "BFP5s115",
- friendly = "The Controller Program",
- side = {"pocket"},
- startup = true
- },
- {
- file = "controller",
- pastebin = "FQX2J2wv",
- friendly = "The recever program",
- side = {"turtle"},
- startup = true
- }
- }
- function download( pastebin, startup, filename )
- if startup then
- print("Would you like this to run on startup, or enter a file name")
- lfilename = io.read()
- if lfilename then
- filename = lfilename
- else
- filename = "startup"
- end
- end
- file = fs.open(filename,'w')
- print("downloading "..filename.." from pastebin")
- file.write(http.get("http://pastebin.com/raw/"..pastebin).readAll())
- file.close()
- end
- for k,v in pairs(files) do
- if fs.exists(v.file) then
- print(v.friendly.." is already on your computer, skipping download")
- else
- if v.side ~= nil then
- if pocket then
- for m,n in pairs(v.side) do
- if n == "pocket" then
- download(v.pastebin,v.startup,v.file)
- end
- end
- elseif turtle then
- for m,n in pairs(v.side) do
- if n == "turtle" then
- download(v.pastebin,v.startup,v.file)
- end
- end
- else
- for m,n in pairs(v.side) do
- if n == "computer" then
- download(v.pastebin,v.startup,v.file)
- end
- end
- end
- else
- download(v.pastebin,v.startup,v.file)
- end
- end
- end
Add Comment
Please, Sign In to add comment