You can run Bin64/console.x64.exe
as nice little (interactive) lua console.
console.x64.exe cmd <lua string to execute>
console.x64.exe <lua file to execute>
For example to execute a lua string:
console.x64.exe cmd "print(1+1)"
For example to execute a lua file:
console.x64.exe test.lua
For an interactive shell start without arguments:
console.x64.exe
Below is a short documentation of its very simplistic API
High-performance timer for accurate time measurements.
local timer = HighPerfTimer()
reset()
- Resets the timer to zeroelapsed()
- Returns elapsed time in seconds since creation or last resetstopAndReset()
- Returns elapsed time and resets timerstop()
- Alias for elapsed() (deprecated)Main engine interface.
update(dtReal, dtSim)
- Updates the engine simulationspawnObject2(...)
- Spawns an object in the simulationdeleteAllObjects()
- Removes all objects from the simulationsetDynamicCollisionEnabled(enabled)
- Enables/disables dynamic collisioninstabilityDetected()
- Checks if instability was detected in simulationRepresents a physical object in the simulation.
getNodeCount()
- Returns the number of nodes in the objectgetBeamCount()
- Returns the number of beams in the objectVirtual file system interface.
the VFS can be accessed with the global variable FS
fileSize(filename)
- Returns size of file in bytesfileExists(filename)
- Checks if file existsdirectoryExists(directory)
- Checks if directory existsgetFileRealPath(virtualPath)
- Gets real filesystem path from virtual pathgetGamePath()
- Gets root game pathopenFile(filename, mode)
- Opens a filecopyFile(src, dst)
- Copies a filedirectoryCreate(name, recursive)
- Creates a directoryfindFiles(path, pattern, recursiveLevels, multiMatch, includeDirs)
- Finds files matching patternhashFile(filename)
- Gets file hashhashFileSHA1(filename)
- Gets file SHA1 hashstat(filename)
- Gets file statsremoveFile(filename)
- Deletes a filerenameFile(oldName, newName)
- Renames a filemount(source, target, priority)
- Mounts a directory or archivemountList(mountList)
- Mounts multiple pathsunmount(path)
- Unmounts a pathisMounted(path)
- Checks if path is mountedinitBeamEngine(steps)
- Initializes the BeamNG enginedestroyBeamEngine()
- Shuts down the BeamNG enginereloadLua()
- Reloads the Lua environmentlog(level, origin, msg)
- Logs a message
level
: Log level (I=Info, W=Warning, E=Error, D=Debug)origin
: Source of the logmsg
: Message to logupdateLuaCore()
- Updates the Lua core systemprofilerPushEvent(name)
- Starts profiling an eventprofilerPopEvent()
- Ends profiling the current eventsetPowerPlanMaxPerformance()
- Sets system power plan to maximum performancerestorePowerPlan()
- Restores original power planhw
- Table with hardware information
hw.bits
- CPU architecture (32 or 64 bit)args
- Command line argumentsbeamng_platform
- Current platform (“windows”, “linux”, etc)