lua-users home
lua-l archive

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


On Sun, Sep 18, 2016 at 12:41 AM, Charles Heywood <vandor2012@gmail.com> wrote:
> The latter. not evaluated first. You can read the manual to find precedence
> documentation.

https://www.lua.org/manual/5.3/manual.html#3.4.8

Thank you for the RTFM, I get lazy sometimes and don't always find the
manual helpful (better for reference than learning, I really should
buy the new PIL).

I was using the middle expression as an intermediate step for understanding:

not 5 == 6 could also be explicitly expressed as  (not 5) == 6,
which both evaluate to false == 6.

would be more correct?

Russ

> On Sun, Sep 18, 2016, 2:27 AM Russell Haley <russ.haley@gmail.com> wrote:
>>
>> On Sun, Sep 18, 2016 at 12:04 AM, Sean Conner <sean@conman.org> wrote:
>> > It was thus said that the Great Russell Haley once stated:
>> >> On Fri, Sep 16, 2016 at 11:23 PM, Sean Conner <sean@conman.org> wrote:
>> >> >
>> >> >         not a == b
>> >> >
>> >> > is true if a is not equal to b.
>> >>
>> >> Hi Sean. My result differed (Lua prompt changed for inline formatting)
>> >> :
>> >>
>> >> Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
>> >> % not 5 == 5
>> >> false
>> >> % not 5 == 6
>> >> false
>> >>
>> >> %  not "Mary"=="Mary"
>> >> false
>> >> % not "Mary"=="mary"
>> >> false
>> >>
>> >> This was run on FreeBSD 10.3
>> >
>> >   I got hosed by precedence (darn!  Should have tested these).  They are
>> > being parsed as:
>> >
>> >         (not 5) == 5
>> >
>> > Try:
>> >
>> >         not (5 == 5)
>> >         not (5 == 6)
>>
>> So does that mean I was seeing
>>
>> not 5 == 6 is equal to  (not 5) == 6  or false == 6?
>>
>> Thanks,
>>
>> Russ
>>
> --