Revision Difference
ents.Iterator#552413
<function name="Iterator" parent="ents" type="libraryfunc">⤶
<description>⤶
Returns an iterator for all existing entities.⤶
⤶
This will be quite a bit faster than <page>ents.GetAll</page>, especially when using the `break` keyword.⤶
</description>⤶
<added>2023.10.13</added>⤶
<realm>Shared</realm>⤶
<rets>⤶
<ret name="" type="function">Iterator function</ret>⤶
<ret name="" type="table">Table of all existing <page>Entity</page>s.</ret>⤶
<ret name="" type="number">Will always be 0. Start index?</ret>⤶
</rets>⤶
</function>⤶
⤶
⤶
<example>⤶
<description>Example usage of this function.</description>⤶
<code>⤶
for i, ent in ents.Iterator() do⤶
if ( ent:GetClass() == "prop_physics" ) then ent:Remove() end⤶
end⤶
</code>⤶
<output>All physics props will be deleted.</output>⤶
⤶
</example>