G.pairs

From GMod Wiki

Jump to: navigation, search
Function
Syntax pairs( Table table )
Where is this used?
Description:
Returns an iterator function for a for loop that will return the values of the specified table in an arbitrary order.
Returns: Function , Table
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.pairs]G.pairs [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionPrints the name of all players.
Used onNewerShared.png
Code
for k,v in pairs( player.GetAll() ) do
  print( v:Name() )
end
OutputNames of players.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox