Garry's Mod Wiki

ents.GetCount

  number ents.GetCount( boolean IncludeKillMe = false )

Description

Gives you the amount of currently existing entities.

Similar to #ents.GetAll() but with better performance since the entity table doesn't have to be generated.
If ents.GetAll is already being called for iteration, than using the # operator on the table will be faster than calling this function since it is JITted.

Arguments

1 boolean IncludeKillMe = false
Include entities with the FL_KILLME flag. This will skip an internal loop, and the function will be more efficient as a byproduct.

Returns

1 number
Number of entities