[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: non-empty false...
- From: David Jeske <jeske@...>
- Date: Tue, 1 Dec 1998 15:14:29 -0800
On Tue, Dec 01, 1998 at 08:54:15PM -0200, Steve Dekorte wrote:
> On Tue, 1 Dec 1998, David Jeske wrote:
> > 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.
>
> I also suggested using 0 instead of nil.
> What about that?
That's what I'm doing now, but it means I have to do things like:
function isTrue(a_var)
-- make sure that both nil and 0 are false... too bad
-- lua dosn't have exceptions, or I'd throw one on nil.
if ((a_var == nil) or (a_var == 0)) then
return nil;
else
return 1;
end
end
if (isTrue(foo)) then
-- do something
end
-- worse, yet, I have to do stuff like:
if (isTrue(foo) and isTrue(bar)) or isTrue(foo2) then
-- do something
end
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net