Before you read this, please keep in mind that I'm completely new to modding beamng drive and also lua (although I have some experience with programming mostly python) My problem is that I can not access (and also don't know how to) electrics (the module?). This means when I write (and please correct me if I wrote it wrong which I almost certainly did) for example: "print(electrics.rpmTacho" it just says that it couldn't find such a thing as electrics and tries to find it in close directories. I have also tried opening it through the exact file directory path pointing to the lua file. So if you know how to help please do so!
When trying to access scripts that are in lua/vehicle make sure you select a vehicle in the console dropdown. In BeamNG vehicles are running their own instance of lua so if you send the command to "GE - Lua" which is the default instance selected in console it won't find vehicle related scripts. The correct command to print rpmTacho is print(electrics.values.rpmTacho) which works as expected when sent to a vehicle instance: If you're confused about how to access certain values from scripts try for example dump(electrics) this will show you all accessible values: If you're trying to access vehicle values from game engine lua scripts without using console you need to use be:getObjectByID(vehid):queueLuaCommand("...") on the GE side and then from the vehicle side obj:queueGameEngineLua("..."). This is a bit confusing but basically a game engine script can call vehicle instance commands and vehicles can "respond" by calling game engine lua. You can use this to pass information between instances. For example this line executed from GE will print the rpmTacho value for the vehicle with ID 39599: be:getObjectByID(39599):queueLuaCommand("obj:queueGameEngineLua(string.format('print(%s)', electrics.values.rpmTacho))")
@oKempi FYI there's a bit of documentation on that ^ topic here: https://documentation.beamng.com/modding/programming/virtualmachines/