1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-04-30 06:13:11 +00:00

Update netrequire.lua

This commit is contained in:
LDDestroier 2019-05-25 22:05:13 -04:00 committed by GitHub
parent abaeacb041
commit 9f730abab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,10 @@ local function netrequire(_name, alwaysDownload, ...)
if (not fs.exists(fs.combine(DL_path, name))) or alwaysDownload then if (not fs.exists(fs.combine(DL_path, name))) or alwaysDownload then
local url = "https://github.com/LDDestroier/CC/raw/master/netrequire/" .. name local url = "https://github.com/LDDestroier/CC/raw/master/netrequire/" .. name
local net = http.get(url) local net = http.get(url)
if net then
url = net.readLine()
net.close()
net = http.get(url)
if net then if net then
local contents = net.readAll() local contents = net.readAll()
net.close() net.close()
@ -19,6 +23,9 @@ local function netrequire(_name, alwaysDownload, ...)
file.write(contents) file.write(contents)
file.close() file.close()
return loadstring(contents)(...) return loadstring(contents)(...)
else
error("Couldn't connect to '" .. url .. "'")
end
else else
error("Cannot find any such API '" .. name .. "'") error("Cannot find any such API '" .. name .. "'")
end end