test
This commit is contained in:
parent
b8ceaf1da0
commit
def9e7e891
34
startup.lua
34
startup.lua
@ -1,3 +1,37 @@
|
|||||||
|
local filesToDownload = {
|
||||||
|
"behavior.lua",
|
||||||
|
"status.lua",
|
||||||
|
"logger.lua"
|
||||||
|
}
|
||||||
|
|
||||||
|
local baseURL = "https://git.fisher.network/cc/turtle/raw/main/"
|
||||||
|
|
||||||
|
-- Helper to download a file
|
||||||
|
local function downloadFile(filename)
|
||||||
|
local url = baseURL .. filename
|
||||||
|
local res = http.get(url)
|
||||||
|
if not res then
|
||||||
|
error("Failed to download " .. filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
local content = res.readAll()
|
||||||
|
res.close()
|
||||||
|
|
||||||
|
local file = fs.open(filename, "w")
|
||||||
|
file.write(content)
|
||||||
|
file.close()
|
||||||
|
print("Downloaded " .. filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Download each file
|
||||||
|
for _, filename in ipairs(filesToDownload) do
|
||||||
|
if not fs.exists(filename) then
|
||||||
|
downloadFile(filename)
|
||||||
|
else
|
||||||
|
print(filename .. " already exists, skipping download.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local behavior = require("behavior")
|
local behavior = require("behavior")
|
||||||
local status = require("status")
|
local status = require("status")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user