AR/Table
Jump to navigation
Jump to search
بسم الله الرحمن الرحيم
___________________________________________________________________
table.foreachi
تستخدم ل إظهار الجدول بصف واحد وتستخدم لفهرسة الجدول <syntaxhighlight lang="lua"> table table.foreachi(table,function)
Click to collapse [-]
Example
t = {1,1,2,3,5,8,13}
test1 = table.foreachi(t,print)
1 1
2 1
3 2
4 3
5 5
6 8
7 13
___________________________________________________________________
table.foreach
تستخدم ل تكرار المفاتيح في الجدول <syntaxhighlight lang="lua"> table table.foreach(table,function)
Click to collapse [-]
Example
k = { apple="green", orange="orange", banana="yellow" }
test1 = table.foreachi(k,print)
apple green
orange orange
banana yellow
الفرق بين ()table.foreachi و ()table.foreach ؟
.. هذي لفهرسة الجدول والثانيه لتكرار مفاتيح الجدول
بس لازم تنتبه ان الثانيه غير مضمونه بما يتعلق الترتيب التي يتم تخزين مفاتيح في جدول.