Files
computercraft/lupdate.lua
2023-10-07 22:58:51 -04:00

21 lines
583 B
Lua

local args = { ... }
local program_name = args[1]
if program_name == nil then
print("Usage: lupdate <program_name>")
return
end
http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/main/" .. program_name .. ".lua", nil, function(response)
if response.getResponseCode() == 200 then
local file = fs.open(program_name .. ".lua", "w")
file.write(response.readAll())
file.close()
print("Updated " .. program_name .. ".lua")
else
print("Failed to update " .. program_name .. ".lua")
print(response)
end
end