Script:
Module Script:
I dont think its possible to do #dic and get the length of dictionary
How can I get the length of a dictionary?
You can instead of writing UltraRareRewards you could give them maual indexes like
1 = {
Desc = “”;
Amount …
}
Then you can do for loop to get the length of it
You can either convert the dictionary into an array of arrays by creating a key/field named “Name” and assigning to it the reward’s name, i.e;
local Rewards = {
{
Name = "Reward Name",
Description = "Reward Description",
Amount = 0,
Chance = 0
}
}
Or you can define a function that retrieves a dictionary’s length.
local t = {a = 1, b = 2, c = 3}
local function dictLength(dict)
local i = 0
for _, _ in pairs(dict) do
i += 1
end
return i
end
local len = dictLength(t)
print(len) --3