simpleHttpServer Reference
Module defined in `lua/common/utils/simpleHttpServer.lua`. Simple HTTP server with static file serving, JSON responses, custom route handlers, and HTML templating.
Module defined in lua/common/utils/simpleHttpServer.lua. Simple HTTP server with static file serving, JSON responses, custom route handlers, and HTML templating.
Exports
Functions
M.start(_bindhost, _bindport, _fileroot, _handlers, _argsCallback)
Start the HTTP server.
- Parameters:
_bindhost- string - Bind hostname/IP_bindport- number - Bind port_fileroot- string - Root directory for static files_handlers- table - Route handler table mapping paths to functions_argsCallback- function|nil - Callback for query parameter processing
M.stop()
Stop the HTTP server and close all connections.
M.update()
Poll for and process incoming HTTP requests. Call each frame.
- Returns: table - Request processing results
Internal Notes
- Uses LuaSocket for TCP networking
- MIME type detection via file extension mapping
serve_fileserves static files with appropriate MIME headersserve_jsonserializes Lua tables as JSON responseshandleroutes requests to registered handlers or falls back to file serving- Uses
resty/template(lustache) for HTML templating - Non-blocking polling via
socket.selectwith zero timeout
pixellib Reference
Module defined in `lua/common/utils/pixellib.lua`. Small pixel drawing library for rendering primitives and text to RGBA buffers, with file save support.
torqueScriptParser Reference
Module defined in `lua/common/utils/torqueScriptParser.lua`. Parses TorqueScript source code into an AST using PEG (Parsing Expression Grammar).