Preventing a table iteration from reading a function value?
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.
04 | airport.destinations.Zakynthos; |
09 | function airport.airlines:GetAirlines() |
13 | for i, v in pairs (airport.airlines) do |
15 | function v:GetDestinations() |