Garry's Mod Wiki

SortedPairsByValue

  function, table SortedPairsByValue( table table, boolean descending = false )

Description

Returns an iterator function that can be used to loop through a table in order of its values.

To sort by specific value member, use SortedPairsByMemberValue.

To sort by keys, use SortedPairs.

Arguments

1 table table
Table to create iterator for
2 boolean descending = false
Whether the iterator should iterate in descending order or not

Returns

1 function
Iterator function
2 table
The table which will be iterated over