ConsoleServer - stingray.ConsoleServer namespace reference - Stingray Lua API Reference
[WebServer] Namespace with functions for interacting with the console server.
|
Hooks a Lua function f to be called whenever a HTTP request is
received with the specified URL prefix.
|
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. |
|
Unhooks a HTTP processor previously hooked with hook_http().
|
Parameters id : | integer |
Specifies the HTTP hook to unhook.
|
Returns | This function does not return any values. |