API Referencecommonutils
HTTP JSON Server
Module defined in `lua/common/utils/httpJsonServer.lua`. Simple HTTP server for implementing quick REST APIs within BeamNG. Handles JSON request/response.
Module defined in lua/common/utils/httpJsonServer.lua. Simple HTTP server for implementing quick REST APIs within BeamNG. Handles JSON request/response.
Exports
Functions
M.init(_bindhost, _bindport, _callback)
Initialize and start the HTTP server.
- Parameters:
_bindhost- string - Bind hostname/IP_bindport- number - Bind port_callback- function - Request handler callback
M.update()
Poll for and process incoming HTTP requests. Call each frame.
Internal Notes
- Uses LuaSocket for TCP
receiveRequestparses raw HTTP request lineshandleServerRequestroutes requests to the callback- Parses URLs via
socket.url - Uses
ltn12for transfer encoding - Non-blocking:
update()checks for connections with zero timeout
See Also
- utils/ - Utility Modules - Directory overview
- calltracer Reference - Related reference
- dateUtils Reference - Related reference
- debugDraw Reference - Related reference
- Common Libraries Overview - Guide
Heatmap Generator
Module defined in `lua/common/utils/heatmap.lua`. Generates SVG heatmap visualizations of vehicle paths on the game map, including road overlay.
Interactive Shell
Module defined in `lua/common/utils/interactiveShell.lua`. Interactive Lua REPL shell for runtime debugging within BeamNG.