Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- delete files
- local function removeFiles(files)
- for _,f in ipairs(files) do
- if fs.exists(f) then
- shell.run("rm " .. f)
- end
- end
- end
- -- save the content of an HTTP link into a file
- local function HTTPSaveToFile(link, filename)
- local h = fs.open(filename, "w")
- local http = http.get(link)
- if http == nil then
- error("Cannot get http object from link :\n" .. link)
- end
- local str = http.readAll()
- if str == "" or str == nil then
- error("Cannot get text from http object")
- end
- h.writeLine(str)
- h.close()
- end
- removeFiles({"lib/item", "lib/objectJSON", "config", "recipesManager", "startup"})
- HTTPSaveToFile("https://gitlab.com/computercraftdaiki/bloodmagic/-/raw/master/lib/item.lua", "lib/item")
- HTTPSaveToFile("https://gitlab.com/computercraftdaiki/bloodmagic/-/raw/master/lib/objectJSON.lua", "lib/objectJSON")
- HTTPSaveToFile("https://gitlab.com/computercraftdaiki/bloodmagic/-/raw/master/config.json", "config")
- HTTPSaveToFile("https://gitlab.com/computercraftdaiki/bloodmagic/-/raw/master/recipesManager.lua", "recipesManager")
- HTTPSaveToFile("https://gitlab.com/computercraftdaiki/bloodmagic/-/raw/master/main.lua", "startup")
- shell.run("startup")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement