Files
computercraft/lib/lum.lua
2023-10-08 04:07:33 -04:00

21 lines
717 B
Lua

local target_branch = "main"
local bin_path = "/bin/"
local lib_path = "/lib/"
local startup_path = "/startup/"
function download_lua(remote_path, local_path)
response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path .. ".lua", nil)
if response.getResponseCode() == 200 then
file = fs.open(local_path, "w")
file.write(response.readAll())
file.close()
else
io.write("Failed to download " .. remote_path .. ".lua\n")
io.write(response)
end
end
function install(package)
io.write("Installing " .. package .. "\n")
download_lua("packages/" .. package .. ".lua", bin_path .. package .. ".lua")
end