[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple assignments to the same variable
- From: Quae Quack <quae@...>
- Date: Wed, 14 Jul 2010 14:02:12 +1000
On 14 July 2010 12:54, Kevin Vermeer <reemrevnivek@gmail.com> wrote:
>
> which is useless for the point of this section of the documentation. Eike's
> code:
>>
>> local pos = 1
>> for i=1,#arr do
>> if arr[i] ~= nil then
>> arr[pos],arr[i],pos = arr[i],nil,pos+1
>> end
>> end
>
> on the other hand, performs a useful function, and is best expressed with
> the multiple assignment statement.
>
> --
>
> Kevin Vermeer
>
>
is it?
arr [ pos ] = arr [ i ]
arr [ i ] = nil
pos = pos + 1
seems fine to me....