wapi is a simple async HTTP library which uses LÖVE threads
Require library and update it
local wapi = require "webapi"
function love.update(dt)
wapi.update()
end
Make request
request = wapi.request({
method = "GET",
url = "http://jsonplaceholder.typicode.com/posts/1"
}, function (body, headers, code)
print(body)
end)
wapi.request(args, callback)
args is a table containing request arguments. See Lua HTTP support
wapi.update()
update all running requests
wapi.cancel(request)
cancel an active request