Garry's Mod Wiki


function, table, any pairs( table tab )


Returns an iterator function(next) for a for loop that will return the values of the specified table in an arbitrary order.

For alphabetical key order use SortedPairs.

For alphabetical value order use SortedPairsByValue.


1 table tab
The table to iterate over


1 function
The iterator (next)
2 table
The table being iterated over
3 any
nil (for the constructor)


Iterates through all players on the server and prints their names.

for k, v in pairs( player.GetAll() ) do print( v:Nick() ) end
Output: A list of players in console.

Page Links

Special Pages



Render Time: 35ms

DB GetPage 3
Generate Html 10
SaveChanges (1) 8
Render Body 0
Render Sidebar 11