lua-users home
lua-l archive

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


>> > a = a or (a == nil and my_default_a)
>>   a = a == nil and my_default_a or a
>> I think that looks more readable, although it doesn't place emphasis on
>> keeping the variable passed.
> they're not equivalent though since (nil or false) ~= (false or nil).
> consider a=nil and my_default_a=false.

Yes, you are correct. My mistake. Very subtle...