6
I want to sort such a table by a value contained in it. Ex:
tabela = {
{pessoa="Joao", idade=20},
{pessoa="Pedro", idade=22},
{pessoa="Lucas", idade=19},
{pessoa="Derp", idade=25}
}
I want to sort the table by age. Something like:
table.sort(tabela, function(table, value1, value2) return table.value1 < table.value2 end)
for x=1, table.maxn(tabela) do
print(tabela[x].idade)
end
Would return:
25
22
20
19
Perfect, best explanation, impossible. It worked here.
– Gabriel Sales
+1 This is a Bible for those who are learning
– Wallace Maxters