Re:No Compiler – On LLVM, and writing software without a com...
by klibertp on Friday March 04, 2016 @01:24PM
(#11225743)
Here:
use `pairs(a_table)` to get `key, val` variables bound respectively. Use `ipairs` to get a loop over indices and values. This is very similar to Python, only with "do/end" instead of indent/dedent. What you can't do in Python, but can in Lua is to provide less variable names than the iterator function returns. For example, to get a list of keys when iterating over `(key, val)` pairs in Python you'd have to do this:
While in Lua it's less explicit:
...and that's it.
[ Parent
| on HN ]
There are no comments on this comment yet.