diff options
Diffstat (limited to 'spec/outputs/comprehension_nested.lua')
| -rw-r--r-- | spec/outputs/comprehension_nested.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/outputs/comprehension_nested.lua b/spec/outputs/comprehension_nested.lua new file mode 100644 index 0000000..abd5792 --- /dev/null +++ b/spec/outputs/comprehension_nested.lua | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | local list = { | ||
| 2 | 1, | ||
| 3 | 2, | ||
| 4 | 3 | ||
| 5 | } | ||
| 6 | local pairs | ||
| 7 | do | ||
| 8 | local _accum_0 = { } | ||
| 9 | local _len_0 = 1 | ||
| 10 | for _index_0 = 1, #list do | ||
| 11 | local i = list[_index_0] | ||
| 12 | if i % 2 == 1 then | ||
| 13 | for _index_1 = 1, #list do | ||
| 14 | local j = list[_index_1] | ||
| 15 | if j > i then | ||
| 16 | _accum_0[_len_0] = tostring(i) .. "-" .. tostring(j) | ||
| 17 | _len_0 = _len_0 + 1 | ||
| 18 | end | ||
| 19 | end | ||
| 20 | end | ||
| 21 | end | ||
| 22 | pairs = _accum_0 | ||
| 23 | end | ||
| 24 | return print(table.concat(pairs, ",")) | ||
