Hello. I wanted to know how to sort my table but I don’t know how to use table.sort()
in this situation. I’ve looked through other posts but I couldn’t find anything similar to the structure of my table.
I was planning to sort these out by the price from the lowest value to the highest:
Table structure:
local gamepasses = {
{
["id"] = 000000000,
["price"] = 10
},
{
["id"] = 000000000,
["price"] = 1
},
{
["id"] = 000000000,
["price"] = 5
}
}
Desired Outcome
local gamepasses = {
{
["id"] = 000000000,
["price"] = 1
},
{
["id"] = 000000000,
["price"] = 5
},
{
["id"] = 000000000,
["price"] = 10
}
}
How would I go about doing this? Thanks in advance.