Garry's Mod Wiki

ents.Iterator

  function, table, number ents.Iterator()

Description

Returns an iterator for all existing entities.

This will be quite a bit faster than ents.GetAll, especially when using the break keyword.

Returns

1 function
Iterator function
2 table
Table of all existing Entitys.
3 number
Will always be 0. Start index?

Example

Example usage of this function.

for _, ent in ents.Iterator() do if ( ent:GetClass() == "prop_physics" ) then ent:Remove() end end
Output: All physics props will be deleted.