ConsoleServer - stingray.ConsoleServer namespace reference - Stingray Lua API Reference

stingray.ConsoleServer namespace reference

Description

[WebServer] Namespace with functions for interacting with the console server.

Functions

Parameters

prefix :

string

A string to match against HTTP request URLs.

f :

fun(integer, string:string)

Function that will be called whenever there is a request. The callback function should follow the format of the sample_http_hook.

The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
Returns

integer

An int that can be used to identify this hook. (Only needed if you need to unhook it later.)

(Use "" to capture all requests.)

Parameters

id :

integer

An integer that identifies a particular request, this is useful when you want to serve web pages asynchronously.

request :

string

The request string from the HTTP request.

Returns

string?

Return a HTML string to serve that web page. Return nil to get a callback again the next frame and serve the page asynchronously.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Parameters

id :

integer

Specifies the HTTP hook to unhook.

Returns
This function does not return any values.