lua-users home
lua-l archive

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


> On Nov 20, 2013, at 11:08 AM, Coda Highland <chighland@gmail.com> wrote:
> 
>> On Wed, Nov 20, 2013 at 9:01 AM, Sean Conner <sean@conman.org> wrote:
>> 
>>  Okay, so what happens here?
>> 
>>        function set_timeout(timeout)
>>          local timeout = timeout or math.huge
>> 
>>          -- rest of function
>>        end
>> 
>>        set_tiemout(0)
>> 
>>  Have I set the timeout to 0, or math.huge?
>> 
>>  -spc
> 
> You've set it to math.huge, but Paige already said that Lunia isn't
> going to support the idiomatic use of and/or for that.
> 
> /s/ Adam

Indeed, it will not. However, I did take Tim's advice and left it so true and false are not equal to numeric 0 and 1!

When developing my switch/case patch with the 0 == false, 1 == true patch I realised that I couldn't really use 0, 1, true and false as 4 unique case vales as 0 and 1 would just match on true and false... which really wasn't what I wanted.

All I really wanted is for numeric 0 to be "mostly false" (I love that phrase, reminds me of "mostly harmless" from HHGTTG), which it now is and works as I would like it to in logical expressions. I am going to rename my "Zero as False" patch to "Zero is Mostly False"! :)

~pmd~