[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: inline conditional assignment possible?
- From: "Nick Trout" <nick@...>
- Date: Thu, 20 Nov 2003 10:38:25 -0800
> -----Original Message-----
> From: Adam D. Moss [mailto:adam@gimp.org]
> Sent: Thursday, November 20, 2003 1:44 AM
> To: Lua list
> Subject: Re: inline conditional assignment possible?
>
> Nick Trout wrote:
> > Just out of interest the ~= nil is redundant. The following does the
> > same:
> >
> > s = project:FindSprite("Title")
> > if s then
> > print("we have a title")
> > end
>
> Is that right? 'if s~=nil' will pass on boolean false, 'if s' will
fail.
I think in this context it's correct (i.e. I reakon FindSprite returns
nil when the name is not found). But you are also right, if false is
returned it is not the same.
I got the and one a bit skewed as well. Mmmm will think twice about
answering mailing lists when I'm working late again :)
Nick