Lua · Variables · Storage and web

http

Fetch data from adolfjon.uz.

FunctionWhat it does
http.get(url, callback) Starts a GET request on a worker thread. The callback runs later on the render thread.

#http.get

http.get(url, callback)

Starts a GET request on a worker thread. The callback runs later on the render thread.

Arguments

urlstring
Must start with https://adolfjon.uz/.
callbackfunction(ok, body)
ok is false when the connection failed. The HTTP status is not passed, so check the body.

Returns

boolean
false when not allowed or 4 requests are already running.
  • Replies are cut at about 512 KB.
Example
http.get("https://adolfjon.uz/storage/uploads/white.png", function(ok, body)
    if ok then logo = draw.load_image_data(body) end
end)