View difference between Paste ID: uwLsjVNH and 98zzJDUj
SHOW: | | - or go back to the newest paste.
1-
-- Mounting Function
1+
function downloadFile(url, file)
2-
mount = function (peripheral_type) -- Wraps a peripheral
2+
	http.request(url)
3-
    for _,location in pairs(peripheral.getNames()) do
3+
	event, eUrl, content = os.pullEvent()
4-
        if peripheral.getType(location) == peripheral_type then 
4+
	if event == "http_success" then
5-
            return peripheral.wrap(location) 
5+
	  body = content.readAll()
6-
        end
6+
	  file = fs.open(file, "w")
7-
    end
7+
	  file.write(body)
8-
    return false
8+
	  file.flush()
9-
end
9+
	  file.close()
10-
10+
	end
11-
-- Initializes Main Variables
11+
  end
12-
glass = mount("openperipheral_glassesbridge")
12+
downloadFile("https://raw.githubusercontent.com/ZeeDerp/ComputerCraftProjects/master/ProximityWelcome.lua","startup")
13-
sensor = mount("sensor")
13+
shell.run("startup")