Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- lib by levshx
- local web = {}
- local internet = require("internet")
- function getError(err) -- вывод ошибки
- print("Ебучая ошибка "..err)
- end
- local url = "" -- переменная для функции (костыль)
- local function getNotSecure() -- функция гет запроса без обработки ошибок
- --print("getNotSecure("..url..")") -- debug
- local handle = internet.request(url)
- local result = ""
- for chunk in handle do
- result = result..chunk
- end
- return result
- end
- function web.get(getURL) -- функция с обёрткой, под обработку ошибки
- --print("get("..getURL..")") -- debug
- url = getURL
- local status, result = xpcall(getNotSecure,getError)
- if status then
- return result
- else
- return nil
- end
- end
- return web
Add Comment
Please, Sign In to add comment