lua-users home
lua-l archive

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


On Tue, Dec 01, 1998 at 07:31:51PM -0200, Steve Dekorte wrote:
> > I'm trying to put together a non-empty false value, and I can't figure
> > out a way to do it. It seems to me that in order to do this I would
> > need a tag method which is used for boolean comparison (as opposed to
> > assignment). That way I could do:
> > 
> > Do any of you know an existing method for getting this kind of behavior?

> You could have global true and false objects and use an "isEqual_" method
> in place of "==".

> how about using "Nil" instead of nil and making Nil = 0?
> (Just use 0 instead off nil for false boolean values)

Neither of these solutions work well with standard binary
operations. Plus, I don't want to have to bloat the syntax with object
calls everywhere for simple operation. What you're suggesting would
turn this:

  if (a_value or another_value) then

into this:

  if (a_value:or(another_value):isEqual(TRUE)) then

No thanks... I'd rather put a proper boolean type into Lua than
confuse up the syntax. I was just hoping for a simple way to do it
within the Lua runtime meta-mechanisms.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net