RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference
calltracer ReferencedateUtils ReferencedebugDraw Referencefilterchain Referenceutils/ - Utility Modulesheatmap ReferencehttpJsonServer ReferenceinteractiveShell ReferencelanguageMap Referenceperf Referencepixellib ReferencesimpleHttpServer ReferencetorqueScriptParser ReferencewsUtils Reference

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

filterchain Reference

Module defined in `lua/common/utils/filterchain.lua`. Functional programming filter chain for signal processing - chains composable filter objects (smooth, interval, scale, digitize, etc.) into a proc

Module defined in lua/common/utils/filterchain.lua. Functional programming filter chain for signal processing - chains composable filter objects (smooth, interval, scale, digitize, etc.) into a processing pipeline.


Exports

Functions

M.test()

Run built-in test/demo of the filter chain system.

Filter Types (via internal F table)

F.smooth(rate)

Smooth a value toward a target at a given rate per second.

F.interval(offsetTime, timeOn, timeOff)

Generate on/off intervals (blinking/pulsing).

F.scale(scaleVal)

Multiply value by a constant.

F.digitize(threshold)

Convert to 0/1 based on threshold (default 0.5).

F.floor()

Apply math.floor to value.

F.clamp(minval, maxval)

Clamp value between min and max (default 0–1).

F.examine(str, commonArgumentsCount)

Debug filter - logs all values passing through with a label.

  • Parameters:
    • str - string - Debug label
    • commonArgumentsCount - number|nil - Number of common args to skip (default 0)

F.startdelay(startdelay)

Delay filter activation until the input has been high for a duration.

  • Parameters:
    • startdelay - number - Required high-time in seconds before passing through

Factory Function (internal)

newFilterchain(filterlist, debug, commonFilterArguments, codeArgs)

Create a new filter chain from a list of filter specifications.

  • Parameters:
    • filterlist - table - Array of filter definitions
    • debug - boolean - Enable debug output
    • commonFilterArguments - table - Shared arguments (e.g., {'dt'})
    • codeArgs - table - Additional code-level arguments

Internal Notes

  • Proof-of-concept functional programming pattern by BeamNG
  • F.plus and F.pushConstant exist in source but are commented out (experimental)
  • Filters are objects with a :get(dt, value) method
  • getGenerator creates filter instances from specification tables
  • getVarByNameInScope resolves dotted variable names in nested tables
  • Common filter argument is dt (delta time) passed to all filters

debugDraw Reference

Module defined in `lua/common/utils/debugDraw.lua`. Lightweight debug drawing API using packed integer colors instead of ColorF/ColorI. Wraps FFI calls to the C++ `BNG_DBG_DRAW_*` functions.

utils/ - Utility Modules

General-purpose utility modules for debugging, profiling, networking, graphics, and data processing.

On this page

ExportsFunctionsM.test()Filter Types (via internal F table)F.smooth(rate)F.interval(offsetTime, timeOn, timeOff)F.scale(scaleVal)F.digitize(threshold)F.floor()F.clamp(minval, maxval)F.examine(str, commonArgumentsCount)F.startdelay(startdelay)Factory Function (internal)newFilterchain(filterlist, debug, commonFilterArguments, codeArgs)Internal Notes