lua-users home
lua-l archive

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


On Fri, 18 Jan 2002 RLake@oxfam.org.uk wrote:

> > 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
>
 <snip>
> 
> It just seems more natural to me.
> 
> R. 

Okay, I see your point. I've always thought that allowing both assignment
and IF-THEN-ELSE statements as expressions was a good thing. Still, either
the "or nil" or false to nil conversion function takes care of the table
deletion problem.

The table deletion issue is the only one you've brought up that impacts
me, and I've already found the one line of code that needed to be modified
to fix the problem (with an IF-THEN, which I will probably now go back and
change to use the "or nil" version).

Of course I have only a few hundred lines of Lua code weren't part of a 
one-shot script. A larger Lua code base would make this much more painful.

I have to say I'm pretty happy with the 4.1work3 version, even the
addition of false has solved at least as many problems as it's introduced.

  - Tom Wrensch

P.S. I have to say that I wish more production software was as solid as
Lua's work releases! Nice job.