ents.Iterator
Description
Returns a Stateless Iterator for all entities.
Intended for use in Generic For-Loops.
See player.Iterator for a similar function for all players.
Internally, this function uses cached values that are stored in Lua, as opposed to ents.GetAll, which is a C++ function.
Because a call operation from Lua to C++ and with a return back to Lua is quite costly, this function will be more efficient than ents.GetAll.
Returns
2 sequential table<Entity>
Table of all existing Entities. This is a cached copy of ents.GetAll.
This table is intended to be read-only.
Modifying the return table will affect all subsequent calls to this function until the cache is refreshed, replacing all of your ents.GetAll usages may come with unintended side effects because of this.
3 number
The starting index for the table of players.
This is always
This is always
0 and is returned for the benefit of Generic For-Loops.
Garry's Mod
Rust
Steamworks
Wiki Help