Count how many NPCs?

Hello, I am wondering how to count how many NPC’s there are on the server. :confused:
I have tried before but without luck, how do I do this? :frown:
Im sure its something about counting tables. :v:

For clarification purposes…

Count spawned NPCs?

Yes, Spawned NPC’s from lua.

[lua]local function CountNPCs()
return #ents.FindByClass(“npc_*”)
end[/lua]

Thank You! :razz:

I didn’t see that you posted that you want to count NPC’s spawned through Lua. That code will count all NPCs, even ones already in the map.

Well, That doesent really matter.
Thats very good!