So I have a dictionary for storing asset IDs and BodyColors returned by the Players:GetCharacterAppearanceInfoAsync()
function:
local Data =
{
Assets =
{
Hats = {},
TShirts = {},
Shirts = {},
Pants = {}
},
BodyColors =
{
Head = {},
Torso = {},
LeftArm = {},
RightArm = {},
LeftLeg = {},
RightLeg = {}
}
}
Running print(data)
prints in the output
table: 00000200066DBCB0
, which is expected behavior.
But when I try to print(data[1]), theoretically, I should be having another table print because table[1] would lead to the Assets subtable, but instead I get nil
printed.
Here’s the actual ModuleScript the data is contained in (this isn’t related to DataStore):
-- Module to store data.
local DataStorage = {}
local MarketplaceService = game:GetService("MarketplaceService")
local Data =
{
Assets =
{
Hats = {},
TShirts = {},
Shirts = {},
Pants = {}
},
BodyColors =
{
Head = {},
Torso = {},
LeftArm = {},
RightArm = {},
LeftLeg = {},
RightLeg = {}
}
}
return DataStorage
Here’s the result of printing this table:
print(Data, Data[1])
> table: 00000200066DBCB0 nil
Any help? Am I not understanding dictionaries correctly? I looked on the wiki for tables and it doesn’t seem to highlight this particular issue. I also tried enclosing the sub-table names with brackets and quotes, but that netted the same result. Is it because there are no keys inside of the sub-tables?