In JS I can create a for loop with multiple variables and conditions. For example:
for (i = 17, k = 17; i \> -1 && f \< 4; --i, --k) {
...
}
Is something like this possible with Lua? [import]uid: 98652 topic_id: 18966 reply_id: 318966[/import]
In JS I can create a for loop with multiple variables and conditions. For example:
for (i = 17, k = 17; i \> -1 && f \< 4; --i, --k) {
...
}
Is something like this possible with Lua? [import]uid: 98652 topic_id: 18966 reply_id: 318966[/import]
yes. [import]uid: 19193 topic_id: 18966 reply_id: 73052[/import]
See here for more info on lua for loops: http://www.lua.org/pil/4.3.4.html [import]uid: 84637 topic_id: 18966 reply_id: 73226[/import]
I don’t think you can write that loop in Lua using the same concept of having the loop do the iterations for you.
But you can do this…
[code]
k = 17
for i = k, 0, -1 do
k = i
…
if f < 4 then
break – assuming your manipulating f in the loop.
end
end
[/code] [import]uid: 19626 topic_id: 18966 reply_id: 73248[/import]