I want to pass already known information in Lua from one table down to next locales, but somehow, I am still receiving "attempt to index nil value". It's probably silly and easy to fix, but I am not a programmer and I learn as I go.
for k,v in pairs(FoundObjects)do if v.HashIs == vehhash then print ("Found Model Name: " .. v.ModNam) -- v.ModNam is known and correct - I want to pass this information down below as "modelName" value local modelName = v.ModNam local ped = GetPlayerPed(-1) local vehicle = GetVehiclePedIsIn(ped, false) local vehhash = GetEntityModel(vehicle) local GetHandling = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDragCoeff") local currentEngineMod = GetVehicleMod(vehicle, 11) originalfInitialDragCoeff = Config.modelName.fInitialDragCoeff originalfDriveBiasFront = Config.modelName.fDriveBiasFront originalfSteeringLock = Config.modelName.fSteeringLock originalfTractionCurveMax = Config.modelName.fTractionCurveMax originalfTractionCurveMin = Config.modelName.fTractionCurveMin originalfTractionCurveLateral = Config.modelName.fTractionCurveLateral originalfLowSpeedTractionLossMult = Config.modelName.fLowSpeedTractionLossMult print(modelName) -- actually prints the value needed! print(originalfInitialDragCoeff) -- unfortunately, this shows as a Nil
vehhash - is numerable value given by a vehicle my game character is in v.ModNam - is correctly transforming vehhash from number to name of the car needed modelName - unfortunately, modelName doesn't share the actual car name and throws at me "attempt to index nil value"
originalfInitialDragCoeff = Config.modelName[i].fInitialDragCoeff - when instead of "modelName" I am gonna write the actual car name, everything works perfectly, but I need the script to do the check in which car player always is, obviously.