Lua Exporter Code

From Automation Game Wiki
Revision as of 18:43, 13 January 2022 by Caswal (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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:


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.


  • 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


  • The files table has the filename as the key, and the file contents as the value.
    • In the 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 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.