[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntax request (coming to terms with false)
- From: RLake@...
- Date: Fri, 18 Jan 2002 17:22:52 -0500
> This, at least, could be made less painful with a function that converts
> false to nil, similar to what you were discussing with the
> ? operator. Thus:
It's actually *exactly* what I was discussing with the ? operator. Hmmph.
As Roberto points out, "x or nil" is somewhat more compact.
Maybe I should have chosen a different example. How about this:
if status, result_or_msg = possible_failure(x, y) then
-- handle result
else
-- handle error message
end
(that could be dofile, for example).
Or how about:
if _, _, capture = strfind(string, pattern) then
-- do something with the capture
else
-- the string didn't contain the pattern
end
It just seems more natural to me.
R.