I am trying to iterate through a hard coded table in a module script, but the module script is returning an empty table for some reason.
Here is the module script (shortened):
local Settings = {}
--[[
Datakey attributes:
Ordered: Indicates whether data is stored in an ordered datastore
Value: The default value that the players receive when they don't have any saved data
Leaderboard: Whether or not that value should be shown on the player list
--]]
Settings.DataKeys = {
["Kills"] = {
["Ordered"] = true,
["Value"] = 0,
["Leaderboard"] = true
},
["Deaths"] = {
["Ordered"] = false,
["Value"] = 0,
["Leaderboard"] = false
},
["Wins"] = {
["Ordered"] = true,
["Value"] = 0,
["Leaderboard"] = true
},
["Losses"] = {
["Ordered"] = false,
["Value"] = 0,
["Leaderboard"] = false
}
}
return Settings
And here is a shortened portion of my other module script requiring and attempting to iterate through the table:
local Settings = require(script.Settings)
local DataKeys = Settings.DataKeys -- Get the keys table from the settings module
local DSS = game:GetService("DataStoreService")
local DataHandler = {}
function CreateValues(player)
print("TEST") -- prints
for key,setting in ipairs(DataKeys) do -- go through keys and settings
print("ITERATING") -- never prints
end
print("TEST 2") -- also prints
end
I am not sure if it is the way I am structuring my table, requiring the table, or some obscure undocumented behavior I’m running into? Any help is much appreciated, thanks. The settings module script is parented to the main module script calling it.