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

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.

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.


Exports

Functions

dequeue.new(data)

Creates a new deque, optionally from existing serialized data.

  • Parameters:
    • data - table|nil - Optional table with existing data and head/tail indices for deserialization
  • Returns: table - A deque object

Instance Methods

deque:push_right(x)

Pushes an element to the right (tail) end. Asserts x is not nil.

  • Parameters: x - any (non-nil) - Element to push

deque:push_left(x)

Pushes an element to the left (head) end. Asserts x is not nil.

  • Parameters: x - any (non-nil) - Element to push

deque:pop_right()

Removes and returns the rightmost element.

  • Returns: any|nil - The element, or nil if empty

deque:pop_left()

Removes and returns the leftmost element.

  • Returns: any|nil - The element, or nil if empty

deque:peek_right()

Returns the rightmost element without removing it.

  • Returns: any|nil

deque:peek_left()

Returns the leftmost element without removing it.

  • Returns: any|nil

deque:rotate_right(n)

Rotates the deque right by n positions (moves tail elements to head).

  • Parameters: n - number|nil - Positions to rotate (default: 1)

deque:rotate_left(n)

Rotates the deque left by n positions (moves head elements to tail).

  • Parameters: n - number|nil - Positions to rotate (default: 1)

deque:remove_right(x)

Removes the first occurrence of x searching from the right.

  • Parameters: x - any - Value to find and remove
  • Returns: boolean - True if found and removed

deque:remove_left(x)

Removes the first occurrence of x searching from the left.

  • Parameters: x - any - Value to find and remove
  • Returns: boolean - True if found and removed

deque:length()

  • Returns: number - Number of elements

deque:is_empty()

  • Returns: boolean - True if no elements

deque:contents()

  • Returns: table - Array of all elements from left to right

deque:iter_right()

  • Returns: function - Iterator yielding elements from right to left

deque:iter_left()

  • Returns: function - Iterator yielding elements from left to right

deque:reset()

Empties the deque.

Internal Notes

  • Internal representation uses head and tail indices - elements stored at integer keys in the table itself
  • _serialize = true flag enables serialization support
  • Supports deserialization: pass existing data table to new() to restore state

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

devUtils Reference

Module defined in `lua/common/devUtils.lua`. Development utilities for sandboxed Lua execution, module local variable introspection, global state snapshots, and table recursion detection.

On this page

ExportsFunctionsdequeue.new(data)Instance Methodsdeque:push_right(x)deque:push_left(x)deque:pop_right()deque:pop_left()deque:peek_right()deque:peek_left()deque:rotate_right(n)deque:rotate_left(n)deque:remove_right(x)deque:remove_left(x)deque:length()deque:is_empty()deque:contents()deque:iter_right()deque:iter_left()deque:reset()Internal Notes