# ents.Iterator

- **Ortam:** İstemci, Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/ents.Iterator
- **Çeviri tarihi:** 2025-10-20

```lua
function, table, number ents.Iterator()
```

## Açıklama

Tüm varlıklar için bir [Durumsuz Yineleyici (Stateless Iterator)](https://www.lua.org/pil/7.3.html) döndürür. [Genel For Döngülerinde (Generic For-Loops)](https://www.lua.org/pil/4.3.5.html) kullanılmak üzere tasarlanmıştır.
Tüm oyuncular için benzer bir fonksiyon olan [player.Iterator](https://gmod.tr/wiki/player.Iterator)'a bakın.

> **NOT:** Dahili olarak bu fonksiyon, bir C++ fonksiyonu olan [ents.GetAll](https://gmod.tr/wiki/ents.GetAll)'ın aksine, Lua'da saklanan önbelleğe alınmış değerleri kullanır. Lua'dan C++'a bir çağrı işlemi *ve* Lua'ya geri dönüş oldukça maliyetli olduğundan, bu fonksiyon [ents.GetAll](https://gmod.tr/wiki/ents.GetAll)'dan daha verimli olacaktır.

## Dönüş Değerleri

1. [function](https://gmod.tr/wiki/function): [ipairs](https://gmod.tr/wiki/Global.ipairs)'den gelen Yineleyici Fonksiyonu.
2. sequential [table](https://gmod.tr/wiki/table)<[Entity](https://gmod.tr/wiki/Entity)>: Mevcut tüm [Varlıkların](https://gmod.tr/wiki/Entity) Tablosu. Bu, [ents.GetAll](https://gmod.tr/wiki/ents.GetAll)'ın önbelleğe alınmış bir kopyasıdır. > **UYARI:** Bu tablonun salt okunur olması amaçlanmıştır. > > Döndürülen tabloyu değiştirmek, önbellek yenilenene kadar bu fonksiyona yapılan sonraki tüm çağrıları etkileyecektir. Bu nedenle, tüm ents.GetAll kullanımlarınızı bununla değiştirmek istenmeyen yan etkilere neden olabilir.
3. [number](https://gmod.tr/wiki/number): Oyuncular tablosu için başlangıç indeksi. Bu her zaman `0`'dır ve [Genel For Döngülerinin (Generic For-Loops)](https://www.lua.org/pil/4.3.5.html) yararı için döndürülür.

### Örnek

Tüm fiziksel prop'ları siler.

```lua
for _, ent in ents.Iterator() do
	if ( ent:GetClass() == "prop_physics" ) then
		ent:Remove()
	end
end
```

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/ents.Iterator
