by johnmo · 13y ago · 0 comments
While true, you should iterate integer-key tables using ipairs and hash tables using pairs.
> No continue statement
Continue doesn't exist? I swear I've used it in Lua 5.1.
> While true, you should iterate integer-key tables using ipairs and hash tables using pairs.
In my opinion, this makes Lua's combination of arrays and dictionaries pointless since one must distinguish between them anyway for iteration.
Either way you should be using not-pairs. If you construct a table in a weird way you can end up with pairs going out-of-order. ipairs works fine, also "for i=1,#t" works fine.