lua-users home
lua-l archive

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

On Wed, Sep 20, 2006 at 05:06:42PM -0300, Roberto Ierusalimschy wrote:
> Sam Roberts wrote:
> > Other than lua doesn't have the C boolean operators (&&, ||, !), which
> > I keep forgetting [...]
> May I ask you (and others) why you need boolean operators in Lua?(This
> is not a rhetorical question. I really want to know what uses boolean
> operators may have in Lua.)

Oops, I didn't mean to imply lua is lacking anything in this specific,

I just mentioned it as one side-effect of "different from what you are
used to" syntax, mostly to say that it was a very MINOR side-effect.

In C/C++/perl/ruby I say "if A || B" or "if !that", in lua I have to say
"if A or B" or "if not that". Its becoming habit, but I forget

Or maybe you thought I meant something different by "boolean operator",
such as a version where the result of "A <boolean-or> B" is always either
"true" or "false"? I have never needed that.


p.s. Now the bitwise operators are another story, I would use those.
Eventually I will probably just implement bit.or(a,b), bit.and(a,b),
bit.inv(a), etc., so far I've gone without.