[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Remind me
- From: "Bilyk, Alex" <ABilyk@...>
- Date: Fri, 17 Oct 2003 17:28:16 -0700
In other words
C --> CONDITION ? X : Y
Lua --> CONDITION and X or Y
AB
-----Original Message-----
From: Nick Trout [mailto:nick@rockstarvancouver.com]
Sent: Friday, October 17, 2003 4:49 PM
To: Lua list
Subject: RE: Remind me
> dow = true
> print("Is today Sunday? ", dow and "yes" or "no")
Is today Sunday? yes
> dow = false
> print("Is today Sunday? ", dow and "yes" or "no")
Is today Sunday? no
>
> -----Original Message-----
> From: Curt Carpenter [mailto:curtc@microsoft.com]
> Sent: Friday, October 17, 2003 4:45 PM
> To: Lua list
> Subject: Remind me
>
> What's the equivalent Lua idiom for C's ? : operator(s)? Obviously I
> could do it with a function, but that seems a little heavy-weight.
>
> Example: Simplify the following:
> print("Is today Sunday? " .. (function (dow) if dow == 0 then
return
> "yes" else return "no" end end) (0))
>
> Thanks,
>
> Curt