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

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 Referencecommon

delayLine Reference

Module defined in `lua/common/delayLine.lua`. Implements a time-based delay buffer for queuing data packets that arrive at one end and exit after a fixed time delay. Originally designed for simulating

Module defined in lua/common/delayLine.lua. Implements a time-based delay buffer for queuing data packets that arrive at one end and exit after a fixed time delay. Originally designed for simulating fuel travel time through exhaust pipes.


Exports

Functions

delayLine.new(delay)

Creates a new delay line with a fixed time delay.

  • Parameters:
    • delay - number - The time in seconds each data packet is delayed
  • Returns: table - A delay line object

Instance Methods

line:push(payload)

Pushes a data packet into the delay line. It will be available for retrieval after the configured delay.

  • Parameters:
    • payload - any - Data to push through the delay line

line:pop(dt)

Advances time by dt and returns all data packets that have completed their delay.

  • Parameters:
    • dt - number - Delta time in seconds
  • Returns: table|nil - Array of delayed payloads that reached the end, or nil if empty

line:popSum(dt)

Like pop, but sums all arriving numeric payloads instead of returning them individually.

  • Parameters:
    • dt - number - Delta time in seconds
  • Returns: number - Sum of all numeric payloads that arrived (0 if none)

line:peek(dt)

Previews which payloads would arrive within the next dt seconds, without consuming them.

  • Parameters:
    • dt - number - Time window to preview
  • Returns: table|nil - Array of payloads that would arrive, or nil if empty

line:reset()

Clears all pending data and resets the internal clock to 0.

Internal Notes

  • Each pushed item gets timestamped with currentTime + delay
  • Internal state: data (payload array), times (timestamp array), length, currentTime
  • popSum breaks out of the loop early when it finds a non-expired item (assumes chronological order)

csvlib Reference

Module defined in `lua/common/csvlib.lua`. Provides CSV and TSV creation, writing, and RFC 4180-compliant parsing.

dequeue Reference

Module defined in `lua/common/dequeue.lua`. Double-ended queue (deque) implementation supporting push/pop from both ends, rotation, removal, and iteration. Based on Pierre Chapuis's library.

On this page

ExportsFunctionsdelayLine.new(delay)Instance Methodsline:push(payload)line:pop(dt)line:popSum(dt)line:peek(dt)line:reset()Internal Notes