lua-users home
lua-l archive

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

On Mon, Oct 12, 2009 at 4:50 PM, André Ericsson <> wrote:
>> I may have missed something while reading through this, but why not
>> use tables, like this?
>> function tostringall(...)
>>    local t={...}
>>    for k,v in ipairs(t)
>>       t[k]=tostring(v)
>>    end
>>    return unpack(t)
>> end
> I believe the reasoning against that was garbage creation concerns.
> The simple cases at the beginning of the function were added due to
> performance concerns.

There have been proposals now and then to add an apairs() iterator, which would
behave like ipairs(), but over its arguments instead of a table's
array part. A little
while back I mentioned one that I had written with minimal garbage in mind: