VEWelcome to the open source BeamNG.Drive Lua docs! I started this project because there isn't much out there about the Lua API, and I got sick of having to use dump to scoure for any useful functions and some lucky inspiration. If you would like to contribute with information, feel free to create a PR on Github. To see the source code for this little project, check out my Github repository. These docs have been generated using the code in that repository, with the help of the DocGen mod I wrote.
You currently find yourself on the VE Lua page. For vehicle-specific Lua docs, check out the GE lua page.
aibackwardsCompatibilitybdebugBeamEngineBeamEngineClassBeamObjectbeamstatebitbullettimecontrollercore_quickAccesscoroutinedamageTrackerdebugdebugdrawerdocgen_maindrivetrainelectricsenergyStorageextensionsffiFILTER_NAMEfireFSgameplayStatisticgameplayStatisticModules_watchAirtimegameplayStatisticModules_watchBurnoutguiguihookshydrosinputiojitjsonlpackLuaLuaClassmapmgrmaterialmathmimeobjodometerospackagepartConditionparticlefilterparticlespathplayerInfopowertrainpropsprotocolsrecoveryscenariosensorssettingssocketsoundsstreamsstringtablethrustersui_simplePowertrainControlvwheelDatawheelsfunction __finalizeLuaBindings(classes, luaVMname)function __luaBindIndex(t, k)function __luaBindIndexStatic(t, k)function __luaBindNewindex(t, k, v)function __luaBindNewindexStatic(t, k, v)function _kv(kv)function addLevelLog(object, logLevel, origin, uniqueErrorCode, message)function altitudeOBB_Plane(c1, x1, y1, z1, plpos, pln)function arrayConcat(dst, src)function arrayFindValueIndex(t, val)function arrayReverse(array)function arrayShuffle(array)function assert(...)function biasFun(x, k)function biasGainFun(x, t, s)function biQuadratic(p0, p1, p2, p3, t)function bpackDecode(...)function bpackEncode(...)function bumpFun(x, peakLeftX, peakRightX, leftSlope, rightSlope, leftY, peakY, rightY, roundness)function bytes_to_string(bytes)function cardinalSpline(p0, p1, p2, p3, t, s, d1, d2, d3)function catmullRom(p0, p1, p2, p3, t, s)function catmullRomCentripetal(p0, p1, p2, p3, t, s)function catmullRomChordal(p0, p1, p2, p3, t, s)function checkTableDataTypes(data, expectedTypes)function clamp(x, minValue, maxValue )function clearLevelLogs()function closestLinePoints(l1p1, l1p2, l2p1, l2p2)function closestLineSegmentPoints(l1p1, l1p2, l2p1, l2p2)function collectgarbage(...)function color(r, g, b, a)function colorGetRGBA(col)function colorHex(rgbHex, a)function concatWorkBuffer(...)function conicBezier(p1, p2, p3, t, w)function constainsCylinder_Point(cposa, cposb, cR, p)function containsEllipsoid_Point(c1, x1, y1, z1, p)function containsOBB_OBB(c1, x1, y1, z1, c2, x2, y2, z2)function containsOBB_point(c1, x1, y1, z1, p)function containsOBB_Sphere(c1, x1, y1, z1, c2, r2)function containsSphere_OBB(c1, r1, c2, x2, y2, z2)function createCurve(points, returnArray)function createGlobalSnapshot(filename)function deepcopy(object)function deserialize(s)function deserializePackages(data, filter)function detectGlobalWrites()function dofile(...)function dump(...)function dumpNotNil(x)function dumps(...)function dumpsz(o, depth)function dumpToFile(filename, ...)function dumpz(o, depth)function enablePhysicsStepHook()function error(...)function executeLuaSandboxed(cmd, source)function exportPersistentData()function flattenTable(tbl)function vec3(x, y, z)function formatTimeStringNow(res)function freqGenC(period, ampl, t)function sign(x)function gcinfo(...)function gcprobe(printZero, omitPrint)function getAllLevelIdentifiers()function getBlueNoise1d(x)function getContrastColor(i, a)function getContrastColorStringRGB(i)function getCurrentLevelIdentifier(raw)function getfenv(...)function getLevelLogs()function getmetatable(...)function getModuleLocals(moduleTbl)function graphs(v, len)function greyColor(x, a)function guardZero(x) --branchlessfunction hex_dump(str)function HighPerfTimer()function HSVtoRGB(h, s, v)function importPersistentData(s)function init(path, initData)function initSystems()function intersectsRay_Capsule(rpos, rdir, cposa, cposb, cR )function intersectsRay_Cylinder(rpos, rdir, cposa, cposb, cR)function intersectsRay_Ellipsoid(rpos, rdir, c1, x1, y1, z1)function intersectsRay_OBB(rpos, rdir, c1, x1, y1, z1)function intersectsRay_Plane(rpos, rdir, plpos, pln)function intersectsRay_Sphere(rpos, rdir, cpos, cr)function intersectsRay_Triangle(rpos, rdir, a, b, c)function inverseLerp(from, to, value)function ipairs(...)function ironbowColor(x, a)function isinf(a)function isnan(a)function isnaninf(a)function jetColor(x, a)function jitprobe()function jsonDecode(content, context)function jsonEncode(v)function jsonEncodePrefix(prefix, v, postfix)function jsonEncodePretty(v, lvl, numberPrecision)function jsonEncodeWorkBuffer(v)function jsonReadFile(filename)function jsonWriteFile(filename, obj, pretty, numberPrecision, atomicWrite)function lerp(from, to, t)function linearScale(v, minValue, maxValue, minOutput, maxOutput)function lineBB2d(x1, y1, x2, y2, radius)function linePointFromXnorm(p0, p1, xnorm)function load(...)function loadfile(...)function loadIni(filename)function loadstring(...)function log(...)function lpad(s, l, c)function median3(a,b,c)function median4(a,b,c,d)function median5(a,b,c,d,e)function module(...)function monotonicSteffen(y0, y1, y2, y3, x0, x1, x2, x3, x)function nanError(x)function newExponentialSmoothing(window, startingValue, fixedDt)function newExponentialSmoothingT(window, window2, startingValue)function newExtensionProxy(parentExtension, identifierPrefix)function newFreqDetector()function newFreqExists()function newFreqFilter1()function newLinearSmoothing(dt, inRate, outRate)function newLineFitting(window, weight, bias, scale)function newNopSmoothing()function newPIDParallel(kP, kI, kD, minOutput, maxOutput, integralInCoef, integralOutCoef, minIntegral, maxIntegral, errorDeadzone)function newPIDStandard(kP, tI, tD, minOutput, maxOutput, integralInCoef, integralOutCoef, minIntegral, maxIntegral, errorDeadzone)function newproxy(...)function newTemporalSigmoidSmoothing(inRate, startAccel, stopAccel, outRate, startingValue)function newTemporalSmoothing(inRate, outRate, autoCenterRate, startingValue)function newTemporalSmoothingNonLinear(inRate, outRate, startingValue)function newTemporalSpring(spring, damp, startingValue)function next(...)function nop()function OBBsquaredDistance(c1, x1, y1, z1, p)function onBeamBroke(id, energy)function onBeamDeformed(id, ratio)function onCallEvent(funName, data)function onCouplerAttached(nodeId, obj2id, obj2nodeId, attachSpeed, attachEnergy)function onCouplerDetached(nodeId, obj2id, obj2nodeId, breakForce)function onCouplerFound(nodeId, obj2id, obj2nodeId, nodeDist)function onDebugDraw(x, y, z)function onDespawnObject()function onDynamicBeamAdded(dbId, nodeId, tag)function onDynamicBeamBroke(dbId, energy)function onDynamicBeamDeleted(dbId)function onGraphicsStep(dtSim)function onNodeCollision(id1, pos, normal, nodeVel, perpendicularVel, slipVec, slipVel, slipForce, normalForce, depth, materialId1, materialId2)function onPhysicsStep(dtPhys)function onSetClusterPosRelRot(cNodeId, pos, relRot)function onSettingsChanged()function onTorsionbarBroken(id, energy)function onVehicleReset(retainDebug)function overlapsOBB_OBB(c1, x1, y1, z1, c2, x2, y2, z2)function overlapsOBB_Plane(c1, x1, y1, z1, plpos, pln)function overlapsOBB_Sphere(c1, x1, y1, z1, c2, r2)function pairs(...)function parseColor(v)function pcall(...)function pointBB2d(x, y, radius)function print(...)function nop()function nop()function PSItoPascal(psi)function push3(x, y, z)function pwm(input, frequency, dutyCycle, timeOffset)function quadraticBezier(p1, p2, p3, t)function quat(x, y, z, w)function quatFromAxisAngle(axle, angleRad)function quatFromDir(dir, up)function quatFromEuler(x, y, z) -- in radiansfunction rainbowColor(numOfSteps, step, format)function randomGauss3()function randomState(v)function rawequal(...)function rawget(...)function rawset(...)function readDictJSONTable(filename)function readFile(filename)function readFiles(filenames, maxBatchSize)function require(...)function require_optional(module)function rerequire(module)function rescale(v, minValue, maxValue, minOutput, maxOutput)function RGBtoHSV(r, g, b)function round(a)function roundNear(x, m)function rpad(s, l, c)function saveCompiledJBeam(data, filename, lvl)function saveCompiledJBeamRecursive(f, data, level)function saveIni(filename, d)function select(...)function serialize(v)function serializePackages(reason)function serializeWorkBuffer(v)function setControllingPlayers(players)function setDifference(dst, src)function setEqual(set1, set2)function setfenv(...)function setmetatable(...)function setUnion(dst, src)function shallowcopy(orig)function shuffledPairs(t, ctx)function sigmoid1(x, a)function sign(x)function sign2(x)function signApply(s, v)function simpleDebugText3d(text, pos, radius, sphereColor, dir)function smootherstep(x)function smootheststep(x)function smoothmax(a, b, k)function smoothmin(a, b, k)function smoothstep(x)function sortedPairs(t, ctx, f)function split(str, delim, nMax)function square(a)function stringFormatWorkBuffer(...)function stringHash(text)function tableContains(t, element)function tableContainsCaseInsensitive(table, element)function tableDepth(tbl, lookup)function tableEndC(tbl)function tableFindKey(t, element)function tableFindRecursion(tbl)function tableFromHeaderTable(entry)function tableInsertC(tbl, data)function tableIsArraySlow(tbl)function tableIsDict(tbl)function tableIsEmpty(tbl)function tableKeys(tbl, target)function tableKeysSorted(tbl, target)function tableMerge(dst, src)function tableMergeRecursive(t1, t2)function tableMergeRecursiveArray(t1, t2)function tableReadOnly(table)function tableRoundRobinKey(tbl, lastKey)function tableSize(tbl)function tableSizeC(tbl)function tableToColor(v)function tableValuesAsLookupDict(tbl, target)function testBindings()function timeprobe(omitPrint)function timeprobeStart()function toBFloat(...)function toFloat(...)function tonumber(...)function tostring(...)function trim(s)function type(...)function ui_message(msg, ttl, category, icon)function unflattenTable(tbl)function unpack(...)function unrequire(m)function updateCorePhysicsStepEnabled()function vec3(x, y, z)function LuaVec3:__tostring()function writeFile(filename, data)function xpcall(...)