RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Debug DrawingGPU Mesh StructsImGui FFIMath Structs (FFI)FFI C DefinitionsPID ControllersCSV LibraryDelay LineDequeDevelopment UtilitiesEvent ReferenceExtension SystemSignal FiltersGraph PathfindingUI BridgeInput Filter Constants2D Bilinear InterpolationIntrospectionJBeam Pretty PrinterJSON AST ParserSJSON ParserJSON Debug ParserJSON Pretty PrinterK-D Tree (2D Boxes)K-D Tree (3D)K-D Tree (3D)Lua SerializerC++/Lua BindingLua CoreLua ProfilerMath LibraryParticlesQuadtreeSettingsTCP ServerTimer SchedulerUtility Library
Call TracerDate UtilsDebug DrawingFilter Chainutils/ - Utility ModulesHeatmap GeneratorHTTP JSON ServerInteractive ShellLanguage MapPerformance ProfilerPixel Drawing LibraryHTTP ServerTorqueScript ParserWebSocket Server

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referencecommonutils

HTTP Server

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_file serves static files with appropriate MIME headers
  • serve_json serializes Lua tables as JSON responses
  • handle routes requests to registered handlers or falls back to file serving
  • Uses resty/template (lustache) for HTML templating
  • Non-blocking polling via socket.select 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

Pixel Drawing Library

Module defined in `lua/common/utils/pixellib.lua`. Small pixel drawing library for rendering primitives and text to RGBA buffers, with file save support.

TorqueScript Parser

Module defined in `lua/common/utils/torqueScriptParser.lua`. Parses TorqueScript source code into an AST using PEG (Parsing Expression Grammar).

On this page

ExportsFunctionsM.start(_bindhost, _bindport, _fileroot, _handlers, _argsCallback)M.stop()M.update()Internal NotesSee Also