API Referencecommonutils
httpJsonServer Reference
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
heatmap Reference
Module defined in `lua/common/utils/heatmap.lua`. Generates SVG heatmap visualizations of vehicle paths on the game map, including road overlay.
interactiveShell Reference
Module defined in `lua/common/utils/interactiveShell.lua`. Interactive Lua REPL shell for runtime debugging within BeamNG.