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

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

Delay Line

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)

See Also

  • cdefDebugDraw Reference - Related reference
  • cdefGpuMesh Reference - Related reference
  • cdefImgui Reference - Related reference
  • Common Libraries Overview - Guide

CSV Library

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

Deque

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 NotesSee Also