lua-users home
lua-l archive

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


On 2013-11-19 6:33 PM, "Coda Highland" <chighland@gmail.com> wrote:
>
> On Tue, Nov 19, 2013 at 3:27 PM, Paige DePol <lual@serfnet.org> wrote:
> >> On Nov 19, 2013, at 5:12 PM, Coda Highland <chighland@gmail.com> wrote:
> >>
> >> I think the question is, what does:
> >>
> >> if zero == false then print("zero == false") end
> >> if zero == true then print("zero == true") end
> >>
> >> output? It's one thing to change the falsiness of 0 in a boolean
> >> context, but does it extend to equality comparisons?
> >>
> >> /s/ Adam
> >
> > Thank you for your input, neither of those lines print anything at this time, so there is a problem somewhere. I also notice that if I change the == to ~= then both lines will print, so there is something going on with the boolean keywords themselves I think.
> >
> > I will check into the issue and see what I can find out. Thank you *very* much for your feedback, it is appreciated! :)
> >
> > ~pmd~
>
> It may not actually be an issue. The change you've been describing has
> MOSTLY been "zero is falsy" rather than "zero is identical to false".
> If that's the case, I personally wouldn't have a problem with saying
> that (0 == false) is false even if 0 evaluates falsy in a boolean
> context.
>
> Really, it's the "and" and "or" operators that are the real concern,
> moreso than equality comparisons.
>
> /s/ Adam
>

If I remember correctly, nil ~= false as well, so it looks like it's working correctly. Unless you had a different idea of correct. ;)