Solved How to read the current car's parts from a lua

Discussion in 'Mod Support' started by Preston Elam, Apr 3, 2020.

  1. Preston Elam

    Preston Elam
    Expand Collapse

    Joined:
    Apr 8, 2017
    Messages:
    19
    I want to create a UI app that essentially acts as a tech inspection for a racing series, I want to make a UI to poll the currently selected car and go through all of it's parts and decide if it's allowed.

    I've figured out that by using getControlVehicle() I can get the beamNGVehicle object returned.
    Once I have this, I don't know how to actually use the returned object to go through it's parts, and setup.

    Thanks in advance, any help is greatly appreciated, you don't have to send a whole code block detailing exactly how to do it, though it would be appreciated, I can work with the documentation that covers how i'd go about this too!
     
  2. i.want.to.mod

    i.want.to.mod
    Expand Collapse

    Joined:
    Jul 11, 2019
    Messages:
    195
    you just need to do alot of reading. its there, trust me. find where the line says your car is spawned and i think just look below it.
     
  3. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
  4. Preston Elam

    Preston Elam
    Expand Collapse

    Joined:
    Apr 8, 2017
    Messages:
    19
    I appreciate the help, I forgot to mark this as solved, but I ended up staying up really late that night and eventually came up with this solution
    Code:
    for k,v in pairs(partmgmt.getConfig().parts) do
      print(k,v)
    end
    edit: didn't know how to do a code block
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice