Garry's Mod Wiki

Revision Difference

Global.SortedPairsByValue#560374

<function name="SortedPairsByValue" parent="Global" type="libraryfunc"> <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 <page>Global.SortedPairsByMemberValue</page>. To sort by **keys**, use <page>Global.SortedPairs</page>. </description> <realm>Shared and Menu</realm> <file line="549-L565">lua/includes/extensions/table.lua</file> <file line="579-L591">lua/includes/extensions/table.lua</file> <args> <arg name="table" type="table">Table to create iterator for</arg> <arg name="descending" type="boolean" default="false">Whether the iterator should iterate in descending order or not</arg> </args> <rets> <ret name="" type="function">Iterator function</ret> <ret name="" type="table">The table which will be iterated over</ret> </rets> </function>