Let's say I have the following array 'vehicles':
local vehicles = { }
local vehicle
for i=1,10 do -- ( considering I have no vehicle spawned on the server before executing this code )
vehicle = createVehicle( 522, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "mta" ) -- dont mind the parameters, it's just mockup data
vehicles[vehicle] = { testvar = 1 }
end
Let's say outside this code, I want to access the "testvar" variable for vehicle ID 1. How can I do that? I have tried doing the following:
outputChatBox(type((vehicles[1]).testvar)) -- vehicles[1] is nil
..but vehicles[1] seems to be nill.