Hello! sorry for late response is the a.value and b.value the exact thing I have to put in my code? Here is an example:
local doors = {
["548381833"] = 50 ,-- sort the 50
["3736935196"] = 250, -- sort the 250
}
table.sort(doors, function(a, b)
return a.value > b.value -- this dont work
end)
print(doors)
--sort all values in the doors list
local sorted = {}
for k, v in pairs(doors) do
table.insert(sorted, {k, v})
end
table.sort(sorted, function(a,b)
return a[2] > b[2]
end)
print("Sorted: ", sorted)
return sorted