Ulydev/wapi

Simple async HTTP requests with LÖVE

★ 9Forks 1LuaGitHub ↗Compare

README

wapi

wapi is a simple async HTTP library which uses LÖVE threads

image

Setup

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)

Usage

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