This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
modding:syntax [2020/08/01 12:32] yoshi |
modding:syntax [2020/08/01 12:35] yoshi [Loops] |
||
---|---|---|---|
Line 105: | Line 105: | ||
The index starts with the startvalue and is modified by stepwidth every time it finishes a loop run. if stepwidth is omitted, the step is 1. As soon as the index is greater or equal to the endvalue, no new loop runs are started. | The index starts with the startvalue and is modified by stepwidth every time it finishes a loop run. if stepwidth is omitted, the step is 1. As soon as the index is greater or equal to the endvalue, no new loop runs are started. | ||
+ | To iterate over all key-value pairs in a table, it is possible to use the '' | ||
+ | |||
+ | <code lua> | ||
+ | for k,v in pairs(t) do | ||
+ | -- looped code | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | In the looped code, the key can be used with '' | ||
==== Conditionals ==== | ==== Conditionals ==== | ||