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.

In sequential tables like player.GetAll or ents.GetAll (and ents.Find* functions), it's more efficient to use ipairs or for iterator.


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 PlayerInitialSpawn hooks on the server and prints their unique identifiers and called function.

for k, v in pairs( hook.GetTable().PlayerInitialSpawn ) do -- The custom name given in the second argument of the hook.Add function. -- Example : "myCustomSpawnFunc". print( "Unique identifier:", k ) -- The hook function. -- Example : "function: 0x3a3f2c80". print( "Called function:", v ) end
Output: A list of all hooks.

Special Pages



Render Time: 29ms

DB GetPage 3
Generate Html 10
SaveChanges (1) 6
Render Body 0
Render Sidebar 7