This commit is contained in:
Astronand committed 2025-09-29 00:03:57 -04:00
1 parent 5111182a4b
commit abd573f686
64 files changed
+2407 -157

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
local internet = {}
local function wrap_request(_url, ...)
local ok, err = http.request(...)
if ok then
while true do
local event, param1, param2, param3 = coroutine.yield()
if event == "http_success" and param1 == _url then
return param2
elseif event == "http_failure" and param1 == _url then
return nil, param2, param3
end
end
end
return nil, err
end
local function get(_url)
if type(_url) ~= "string" then
error("URL must be a string")
end
return wrap_request(_url, _url)
end
function internet.get(url) return get(url).readAll() end
newComponent("internet", internet)