1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-08-29 09:02:27 +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

View File

@@ -13,12 +13,19 @@ local function netrequire(_name, alwaysDownload, ...)
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 if net then
local contents = net.readAll() url = net.readLine()
net.close() net.close()
local file = fs.open(fs.combine(DL_path, name), "w") net = http.get(url)
file.write(contents) if net then
file.close() local contents = net.readAll()
return loadstring(contents)(...) net.close()
local file = fs.open(fs.combine(DL_path, name), "w")
file.write(contents)
file.close()
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