[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntax request (coming to terms with false)
- From: Roberto Ierusalimschy <rieru@...>
- Date: Fri, 18 Jan 2002 10:36:32 -0600 (CST)
On Thu, 17 Jan 2002 RLake@oxfam.org.uk wrote:
> OK, I'm trying to come to terms with false. I've started going through my
> code looking for places where I assign the result of a boolean expression
> to a table expecting nil to delete the key (since false will no longer do
> that). Maybe I'm the only person with this problem.
>
> [...]
> ej:
>
> if t = function_which_might_return_false(x) then
> a[x] = t
> else
> a[x] = nil
> end
The following code does the trick you want:
a[x] = function_which_might_return_false(x) or nil
-- Roberto