I am trying to sort my table so I can then just do table[1], table[2], etc. However, I do not know how to do this as the table isn’t just {0,5,1,3} it contains variables {Variable = 1, Variable = 2}.
So the module I am using creates the dictionary using this function, how would I modify it to match your example number 1?
function Path:GetAllProgress(Mode)
local Summary = {}
for k, v in pairs(self.PlayerProgress) do
Summary[k] = (Mode==0 or string.lower(tostring(Mode)) == "absolute") and Path.PlayerProgress[k] or Path.PlayerProgress[k]/self.Length
end
return Summary
end
function Path:GetAllProgress(Mode)
local Summary = {}
for k, v in pairs(self.PlayerProgress) do
table.insert(Summary, {k, (Mode==0 or string.lower(tostring(Mode)) == "absolute") and Path.PlayerProgress[k] or Path.PlayerProgress[k]/self.Length})
end
return Summary
end
And then to retrieve information:
local key, value = Summary[someNumber][1], Summary[someNumber][2]