From def9e7e8915efc3df01c24ecc5aaebe41ad9d5ba Mon Sep 17 00:00:00 2001 From: Laurie Fisher Date: Fri, 27 Jun 2025 14:25:00 +0100 Subject: [PATCH] test --- startup.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/startup.lua b/startup.lua index 98cb25b..f3790f9 100644 --- a/startup.lua +++ b/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 status = require("status")