I have the following code in a ModuleScript, for a tutorial. It works fine to pull data from it. My problem is that trying to count the amount of items inside the table always returns 0. Did I do something wrong with the formatting of the table?
-- ModuleScript
local tutorial = {
["1"] = {
["Title"] = "Test";
["Content"] = "David sucks at editing these c:<";
["Beam"] = {script.TutorialBeam, Vector3.new(0,10,0)};
},
["2"] = {
["Title"] = "Test #2";
["Content"] = "it works!";
["Beam"] = {script.TutorialBeam, Vector3.new(0,5,35)};
};
}
return tutorial
-- LocalScript
local function beginTutorial()
tutorialWindow.Visible = true
local index = 0
local maxIndex = #tutorialStages
print(maxIndex) -- This always prints out as 0, regardless of the amount of items inside the table
tutorialWindow.Commit.MouseButton1Click:Connect(function()
index += 1
local step = tutorialStages[tostring(index)] -- This actually works.
end
end
Thanks in advance!