Example
Sorting table by an integer
local tbl
= {
{
"Jeff", 8 },
{
"Peter", 17 },
{
"Shay", 11 },
{
"Janine", 1 }
}
table.
sort( tbl,
function(a, b)
return a[2]
> b[2]
end )
Output: Table going from highest number to lowest (1: Peter, 2: Shay, 3: Jeff, 4: Janine)
Example
Sorting a player table by a NWInt
Output: Player table sorted by score going from highest to lowest