lua-users home
lua-l archive

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


On 22 May 2010 22:56, Klaus Ripke <paul-lua@malete.org> wrote:
> On Sat, May 22, 2010 at 03:42:23PM +0300, M Joonas Pihlaja wrote:
>> > Without ipairs(), how do I code this convenient (and clear) idiom:
>> >
>> > --
>> >
>> > for _,v in ipairs{'lumpi','ist','mein',hund'} do
>> >    print(v)
>> > end
>>
>> Using pairs().
>>
>> for _,v in pairs{'lumpi','ist','mein',hund'} do
>>    print(v)
>> end
>
> this might as well print Yoda-ish "mein hund lumpi ist".
> ("my dog lumpi is")
>

or in the rare situations you do actually need the ipairs function:
provide/write it.
otherwise how often are you providing literals in your fors?