-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstartup.lua
More file actions
85 lines (73 loc) · 2.17 KB
/
startup.lua
File metadata and controls
85 lines (73 loc) · 2.17 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
local libURL = "https://raw.githubusercontent.com/StormFusions/Draconic-ComputerCraft-Program/main/lib/f.lua"
local libURL2 = "https://raw.githubusercontent.com/StormFusions/Draconic-ComputerCraft-Program/main/lib/button.lua"
local startupURL = "https://raw.githubusercontent.com/StormFusions/Draconic-ComputerCraft-Program/main/reactor.lua"
local lib, lib2, startup
local libFile, lib2File, startupFile
fs.makeDir("lib")
lib = http.get(libURL)
libFile = lib.readAll()
if fs.exists("lib/f") == false then
local file1 = fs.open("lib/f", "w")
file1.write(libFile)
file1.close()
print("API F downloaded")
else
local file1 = fs.open("lib/f", "r")
local f = file1.readAll()
if libFile ~= f then
file1.close()
local file2 = fs.open("lib/f", "w")
file2.write(libFile)
file2.close()
print("API F updating...")
else
file1.close()
print("API F up to date")
end
end
lib2 = http.get(libURL2)
lib2File = lib2.readAll()
if fs.exists("lib/button") == false then
local file1 = fs.open("lib/button", "w")
file1.write(lib2File)
file1.close()
print("API Button downloaded")
else
local file1 = fs.open("lib/button", "r")
local b = file1.readAll()
if lib2File ~= b then
file1.close()
local file2 = fs.open("lib/button", "w")
file2.write(lib2File)
file2.close()
print("API Button updating...")
else
file1.close()
print("API Button up to date")
end
end
startup = http.get(startupURL)
startupFile = startup.readAll()
if fs.exists("reactor") == false then
local file1 = fs.open("reactor", "w")
file1.write(startupFile)
file1.close()
print("Reactor File downloaded")
else
local file1 = fs.open("reactor", "r")
local reactor = file1.readAll()
if startupFile ~= reactor then
file1.close()
local file2 = fs.open("reactor", "w")
file2.write(startupFile)
file2.close()
print("Reactor File updating...")
else
file1.close()
print("Reactor File up to date")
end
end
print("Finished")
print("Starting Program")
sleep(5)
shell.run("reactor")