[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 4.0
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 26 Aug 2000 10:47:08 -0300 (EST)
>> - `for' statement for tables: «for k,v in t do ... end»
>Forgive me if this topic has already been beaten to death, but what is
>the advantage of this new syntax over the old foreach, such as:
>foreach(t, function(k,v) ... end)
>I suppose it eliminates the need to refer to upvalues with the "%"
>syntax, but what else?
Right, it avoids upvalues. And it also avoids the cost of a function call
per each element in the table.