Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How do I use methods in a module script?

Asked by
ausmel105 140
8 years ago

Hello,

I would like to find a way to get this method which is supposed to output a table with the raw string values of each airport name to work. Currently not even the method is being triggered/fired.

I would greatly appreciate any help.

My module script:

01local airport = {}
02 
03airport.destinations = {
04    Zakynthos = {
05        Name = "Zakynthos";
06        IATA = "ZAK"
07    }
08}
09 
10airport.airlines = {
11    Airline = {
12        Name = "Airline";
13        GroupID = 1;
14        IATA = "AA";
15        Destinations = {
View all 34 lines...

Script

1local ReplicatedStorage = game:GetService("ReplicatedStorage")
2 
3local dest = airportData.airlines.Airline:GetDestinations()
4 
5for i, v in ipairs(dest) do
6    print(v)
7end

Thank you!

0
To get a module you must require. so just put local dest = require(airportData.airlines.Airline:GetDestinations). If I knew the answer to your other question, I would put this in an answer. (but i don't) DeveloperSolo 370 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Why do you have a GetDestinations method when you just re-iterate through them? Just iterate through airportData.airlines.Airline.Destinations. There's no point in having a method.

You're just over thinking it, bud.

Hope you can accept this as an answer.

Ad

Answer this question