Skip to content

Network functions

http_get

source

function http_get(url: string): string?
url: string

Returns string? (may be nil)

Send a synchronous HTTP GET request and return response as a string or nil on an error. Requires unsafe mode.

http_get_async

source

function http_get_async(url: string, on_data: fun(p1: string?, p2: string?))
url: string
on_data: fun(p1: string?, p2: string?)

Send an asynchronous HTTP GET request and run the callback when done. If there is an error, response will be nil and vice versa. The callback signature is nil on_data(string response, string error). Requires unsafe mode.

udp_send

source

function udp_send(host: string, port: integer, msg: string): integer
host: string
port: integer
msg: string

Returns integer

function udp_send(address: string, msg: string): integer
address: string
msg: string

Returns integer

Send data to specified UDP address. Requires unsafe mode.