Help me pls got table.insert out of bounds


#1

RegisterServerEvent(‘gs:CekVeh’) --3
AddEventHandler(‘gs:CekVeh’, function()
vehicles = {}
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
local player = user.getIdentifier()
–MySQL.Async.fetchAll(“SELECT id, vehicle_model, vehicle_plate, vehicle_state FROM user_vehicle WHERE identifier=@identifier”,{[’@identifier’] = user.getIdentifier()}, function(result)
MySQL.Async.fetchAll(“SELECT * FROM user_vehicle WHERE identifier = @username”, {[’@username’] = player}, function(result)
if (result) then
for k, v in ipairs(result) do
t = {[“ID”] = v.ID,[“vehicle_model”] = v.vehicle_model, [“newveh”] = v.newveh,[“vehicle_name”] = v.vehicle_name,[“vehicle_state”] = v.vehicle_state}
print("-----------------------------")
print(“cek data mobil di server”)
print("-----------------------------")
print(v.ID)
print(v.vehicle_model)
print(v.vehicle_plate)
print(v.vehicle_state)
print(“cek finish”)
print("-----------------------------")

               table.insert(vehicles, tonumber(v.ID), t) 
               TriggerClientEvent('gs:getVehicles', source, vehicles)
        end         
        end    
      end)

end)  
--print(vehicles[1].id)
--print(vehicles[2].vehicle_model)

end)

=====================================================