lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>for elt in t do
>	do_whatever(elf)
>This is not the most general 'for' you can think of, but this is what I do
>most of the time: go through a table and look at each element. Sure, you
>can do it using next etc, but this would be much less hassle.

This will be catered for in 3.1 with a new builtin function 'foreach'.
With this, your example will be written
or something like that.
Moreover, 3.1 will bring dynamic function closures so you'll be able to write

	foreach(t,function (x) print( end)