Hello,
I'm trying to include methods with the following tables, the data won't change ingame so I don't need to use classes. I have included the following data structure as an example.
When I try and attach a method to a table within "airport.airlines.Airline", such as :GetDestinations() I get an error "attempt to index local 'v' (a function value)".
My guess is that because I'm attaching a seperate method to airport.airlines, when my script iterates over the table it reads the method also, causing the error.
What can I do to prevent this? I know swapping the two around would work but that's not a clean solution.
Thanks for your time.
airport.airlines = {
Airline = {
Destinations = {
airport.destinations.Zakynthos;
}
}
}
function airport.airlines:GetAirlines()
-blah
end
for i, v in pairs(airport.airlines) do
function v:GetDestinations()
--blah
end
end

3 comments
thanks!
Also, would a metatable work in preventing this from happening. Because it makes values "hidden"?
It's not that they're "hidden" so much as
pairsdoesn't look there