mirror of
https://github.com/LDDestroier/CC/
synced 2025-04-30 06:13:11 +00:00
Update netrequire.lua
This commit is contained in:
parent
abaeacb041
commit
9f730abab4
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user