BeamObjectPool Folder Overview
Single-file module implementing BeamNG's object pool Lua VM.
Single-file module implementing BeamNG's object pool Lua VM.
Files
- main.lua - Object pool VM that manages vehicle objects in a shared pool. Provides CRUD operations (get/set/move/delete), vehicle initialization via jbeam stage2, event handler stubs for collisions/damage, and a
_Gmetatable system for per-object global variable scoping.
Architecture
The object pool acts as an intermediary between the engine and vehicle Lua VMs. Objects are stored as lpack-serialized tables, with _setObj() switching the active object context so global variable access routes to the correct object's data.
SceneTree - Scene Graph Queries
Reference for `scenetree`, the scene graph interface for finding and manipulating engine objects (vehicles, lights, sound emitters, terrain, GUI elements, etc.).
ObjectPool main Reference
Module defined in `lua/objectpool/main.lua`. Object pool Lua VM that manages vehicle objects in a shared pool, providing spawn, get, move, set, and delete operations. Acts as the bridge between the Be