lua-users home
lua-l archive

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


On Tue, Jul 13, 2010 at 12:54 AM, Alexander Altshuler <alt@kaluga.ru> wrote:
>>I stumbled accross something I couldn't find an anwer to in the Lua
>>manual. How is the bahavior of multiple assignments to the same
>>variable defined, e.g.
>>a,a = 1,2
>>or
>>t[1],t[1] = 1,2
> >From tests, it seems like the values are assigned from right to left,
>>overwriting the previous values (so a and t[1] is 1). However, since
>>this is not described in the manuals, I fear that this behavior might
>>not be stable. Or maybe someone can hint me where this behavior is
>>described if I overlooked it.
>
> http://www.lua.org/manual/5.1/manual.html#2.4.3
>
>

I'm not sure where that defines how the statement is evaluated when
the same variable appears twice on the left side of the assignment.

-- 
~Jonathan