Skip to content

http

Asynchronous HTTPS requests, off the game thread. Needs the http capability, so http is nil unless it was granted. https only, any host. Each call takes a callback(success, response); the response is { status, body, headers, error? }.

http.get(url: string[, options: table], callback: fun(success: boolean, response: table))

Argument Type Description
url string https URL.
options table { headers?, body? }. Optional.
callback function callback(success, response).

GETs url.

http.post(url: string, options: table, callback: fun(success: boolean, response: table))

Argument Type Description
url string https URL.
options table { headers?, body? }.
callback function callback(success, response).

POSTs url with options.

http.request(method: string, url: string, options: table, callback: fun(success: boolean, response: table))

Argument Type Description
method string "GET" or "POST".
url string https URL.
options table { headers?, body? }.
callback function callback(success, response).

Sends method to url.