iteration

This commit is contained in:
Layla 2023-10-08 04:10:24 -04:00
parent 745de810e4
commit b52af66471

View File

@ -3,8 +3,24 @@ local bin_path = "/bin/"
local lib_path = "/lib/"
local startup_path = "/startup/"
settings.define("lum.target_branch", {
description = "Target branch for updates",
type = "string",
default = "main"
})
settings.define("lum.log_level", {
description = "Log Level",
type = "string",
default = "debug"
})
function download_lua(remote_path, local_path)
response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path .. ".lua", nil)
local url = "https://gitea.layla.gg/layla/computercraft/raw/branch/" .. settings.get("lum.target_branch") .. "/" .. remote_path .. ".lua"
if settings.get("lum.log_level") == "debug" then
io.write("Downloading " .. url .. " to " .. local_path .. "\n")
end
local response = http.get(url, nil)
if response.getResponseCode() == 200 then
file = fs.open(local_path, "w")
file.write(response.readAll())