nicknames = {
{name = "Mike", nick="Kokoa"},
{name = "John", nick="Berserker"},
{name = "Lenny", nick="Angelina"},
{name = "Ariel", nick="Zelda"},
{name = "Yngwie", nick="Rising Force"},
}
function sortByNameReverse(tableToSort)
table.sort(tableToSort, function (a,b) return (a.name > b.name) end)
end
sortByNameReverse(nicknames)
for i, v in pairs(nicknames) do
print(v.name, v.nick)
end
table.sort 의 default 비교 함수는 < 이다.참고링크 : Table Library Tutorial
No comments:
Post a Comment