lua-users home
lua-l archive

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


On 17 January 2015 at 08:17, Dmitry V. Zaitsev <hhrhhr@gmail.com> wrote:
> from manual:
>
>> Operator precedence in Lua follows the table below, from lower to higher
>> priority:
>> [[cut]]
>>      <<    >>
>>      ..
>>      +     -
>>      *     /     //    %
>> [[cut]]
>
>
> test example with wrong result:

I think the table is the opposite way around to how you think it is.
The ones at the top are *lower* priority - i.e. they operate last.
Therefore the shifts happen after all the other operators in your
examples, and the brackets are necessary.

Regards,
Matthew