lua-users home
lua-l archive

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


On Tue, Apr 3, 2012 at 07:47, Miles Bader <miles@gnu.org> wrote:
> Duncan Cross <duncan.cross@gmail.com> writes:
>> That seems like a bad example - in my experience, the index value in
>> an ipairs loop is useful more often than not.
>
> I dunno, I seem to ignore the key in awful lot of for loops...
>
> Given the prevalence of "iterate over the values only" in many
> languages, it is a bit odd that Lua doesn't have it.
>
> -Miles
>
> --
> Egotist, n. A person of low taste, more interested in himself than in me.
>

Well, Lua does have it - it's ipairs(). You just discard the first
return value if you don't need it.

-- 
Sent from my toaster.