-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependencyFetcher.lua
32 lines (26 loc) · 1.15 KB
/
dependencyFetcher.lua
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
-- MIT license Lupus590
-- a better way of doing this might be soemthing like this https://metis.madefor.cc/
local ccStringsUrl = "https://raw.githubusercontent.com/SquidDev-CC/CC-Tweaked/f7e3e72a6e8653f192b7dfad6cf4d072232e7259/src/main/resources/data/computercraft/lua/rom/modules/main/cc/strings.lua"
if not pcall(require, "cc.strings") then
print("Attempting to download required module (cc.strings) from CC-Tweaked GitHub.")
print("This should only happen once per computer.")
local httpHandle, err = http.get(ccStringsUrl)
if not httpHandle then
printError("Error downloading file.")
error(err, 0)
end
local file, err = fs.open("modules/main/cc/strings.lua", "w")
if not file then
httpHandle.close()
printError("Error saving downloaded file.")
error(err, 0)
end
file.write(httpHandle.readAll())
httpHandle.close()
file.close()
print("Downloaded to /modules/main/cc/strings.lua")
print("Press any key to continue")
os.pullEvent("key")
end
package.path = "/modules/main/?;/modules/main/?.lua;/modules/main/?/init.lua;"..package.path
local strings = require("cc.strings")