# table.SortByKey

- **Ortam:** İstemci, Sunucu, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/table.SortByKey
- **Çeviri tarihi:** 2025-09-08

```lua
table table.SortByKey( table tab, boolean descending = false )
```

## Açıklama

Anahtarların değerlerine göre sıralanmış bir anahtar listesi döndürür.

Normal sıralama için [table.sort](https://gmod.tr/wiki/table.sort) sayfasına bakın.

## Argümanlar

1. [table](https://gmod.tr/wiki/table) **tab**: Sıralanacak tablo. Bu tablonun tüm değerleri aynı türde olmalıdır.
2. [boolean](https://gmod.tr/wiki/boolean) **descending** = false: Sıralama azalan düzende mi olmalı?

## Döndürülen Değerler

1. [table](https://gmod.tr/wiki/table): Verilen tablodaki değerlere göre sıralanmış bir anahtar tablosu.

### Örnek

Fonksiyonun örnek kullanımı.

```lua
local t = {}
t['h'] = 2 -- En düşük değer
t['a'] = 150 -- En yüksek değer
t['x'] = 30

PrintTable( table.SortByKey( t ) )
PrintTable( table.SortByKey( t , true ) )
```

**Çıktı:**

```lua
1 = a
2 = x
3 = h
```

```lua
1 = h
2 = x
3 = a
```

- [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/table.SortByKey
