-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary_loader.lua
More file actions
42 lines (35 loc) · 1.04 KB
/
library_loader.lua
File metadata and controls
42 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
local Libraries = {
["json"] = "https://raw.githubusercontent.com/G-A-Development-Team/libs/main/json.lua"
}
----------------------
-- Don't Edit Below --
----------------------
local tbl = {}
for loc, url in pairs( Libraries ) do
tbl[ loc ] = {}
tbl[ loc ].found = false
tbl[ loc ].url = url
end
Libraries = tbl
file.Enumerate( function( filename )
for loc, data in pairs( Libraries ) do
if filename == "libraries/" .. loc .. ".lua" then
print( "[Library Loader] Library found " .. loc )
Libraries[ loc ].found = true
end
end
end)
for loc, data in pairs( Libraries ) do
if not Libraries[ loc ].found then
local body = http.Get( data.url )
file.Write("libraries/" .. loc .. ".lua", body)
print( "[Library Loader] Getting new library " .. loc )
end
end
for loc, data in pairs( Libraries ) do
RunScript("libraries/" .. loc .. ".lua")
print( "[Library Loader] Running " .. loc )
end
---------------------
-- Script Complete --
---------------------