No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
Here is a good resource for quickly covering how Lua works: https://learnxinyminutes.com/docs/lua/ | Here is a good resource for quickly covering how Lua works: https://learnxinyminutes.com/docs/lua/ | ||
== DoExport == | |||
The root function Automation calls on exporting. It passes in the [[CarCalculator]] and the Car File (see below). It returns both files to be written out by the exporter. Such as text configuration files. And a Data table that can be accessed in the C++ DLL for manipulating any data, or writing more complex binary files. | |||
=== Arguments === | === Arguments === |
Latest revision as of 18:43, 13 January 2022
Overview
The Exporter dll passes to Automation any number of Lua files to be loaded into a self contained Lua environment. There must be a global DoExport function, with CarCalculator and CarFile as an arguments. DoExport returns 2 tables (effectively a Lua Dictionary) of Files and Data.
Here is a good resource for quickly covering how Lua works: https://learnxinyminutes.com/docs/lua/
DoExport
The root function Automation calls on exporting. It passes in the CarCalculator and the Car File (see below). It returns both files to be written out by the exporter. Such as text configuration files. And a Data table that can be accessed in the C++ DLL for manipulating any data, or writing more complex binary files.
Arguments
- CarCalculator is the massively overweight 'class' that contains all simulation data about the currently exported car, but no mesh data. That is all in C++.
- CarFile is the contents of a normal Automation .car file. This should be copied into the returned Files list. So the original car can be easily bought back into Automation and edited. In the example file you can see it being copied into the Files list by a file name generated from the Car's Model and Trim Name
Results
- The files table has the filename as the key, and the file contents as the value.
- In the BeamNG.drive exporter, this is the camso_engine.jbeam file containing all the engine and drivetrain performance .
- The Data table has the data name as a key, and the data (either string or number) as the value.
- In the BeamNG.drive exporter, this contains data for weights, wheel data, stiffness values that the C++ code uses when creating the node and beam geometry required for the physics simulation of the car soft body.