Im programming Lua at the moment and im pretty new to this language. Ive got a problem where i got a model of a car. Then i have to search inside an array for an array that contains this model and return the costs of it. So example if i got the model name "zion" it need to returns the costs of it. Really cant figure out how to do this. Hope someone can help me to a solution.
local vehicles = {
{name = "Honda Civic", costs = 99000, description = {}, model = "blista2"},
{name = "Peugeot 206 GTI", costs = 79000, description = {}, model = "blista"},
{name = "Golf R32", costs = 300000, description = {}, model = "zion"},
{name = "Mercedes Brabus", costs = 2000000, description = {}, model = "schafter2"},
{name = "f620", costs = 80000, description = {}, model = "f620"},
{name = "Toyota supra", costs = 290000, description = {}, model = "massacro2"},
}
So i got the model "zion" which is second array. Hope you can help to get printed the costs = 79000