Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local unicode = require("unicode")
- local fs = require("filesystem")
- local gpu = component.gpu
- local applications = {
- { url = "https://raw.githubusercontent.com/RadioNurshat/Luaproject/master/NEECSAPI.lua", path = "/lib/NEECSAPI.lua" },
- { url = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", path = "/lib/ECSAPI.lua" },
- { url = "https://raw.githubusercontent.com/RadioNurshat/Luaproject/master/Shop/JSON.lua", path = "/lib/JSON.lua" },
- { url = "https://raw.githubusercontent.com/RadioNurshat/Luaproject/master/Shop/shopcount.json", path = "/Shop/shopcount.json" },
- { url = "https://raw.githubusercontent.com/RadioNurshat/Luaproject/master/Shop/Заказы/gs.config", path = "/Заказы/gs.config" },
- { url = "https://raw.githubusercontent.com/RadioNurshat/Luaproject/master/Shopping program v2.lua", path = "/RNShop.lua" },
- }
- function getFile(url, path)
- local file = io.open(path, "w")
- local pcallSuccess, requestHandle, requestReason = pcall(component.internet.request, url)
- if pcallSuccess then
- if requestHandle then
- while true do
- local data, reason = requestHandle.read(math.huge)
- if data then
- file:write(data)
- else
- requestHandle:close()
- if reason then
- error(reason)
- else
- file:close()
- return
- end
- end
- end
- else
- errro("Invalid URL addess")
- end
- else
- error("Usage: component.internet.request(string url)")
- end
- file:close()
- end
- --Программа
- for i = 1, #applications do
- getFile(applications[i].url, applications[i].path)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement