[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3 precedence issue
- From: Matthew Wild <mwild1@...>
- Date: Sat, 17 Jan 2015 08:31:55 +0000
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