Garry's Mod Wiki

Garry's Mod Wiki

  table.SortByMember( table tab, any memberKey, boolean ascending = false )

Description

Sorts a table by a named member.

Arguments

1 table tab
Table to sort.
2 any memberKey
The key used to identify the member.
3 boolean ascending = false
Whether or not the order should be ascending.

Example

Orders a table by a member and prints it.

local tab = { { Name = "Bill", Age = 13 }, { Name = "Jill", Age = 14 }, { Name = "Phil", Age = 8 } } table.SortByMember( tab, "Age" ) for _, v in ipairs( tab ) do print( v.Name ) end
Output: Jill Bill Phil

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...