lua-users home
lua-l archive

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

On Sun, Sep 8, 2013 at 4:46 PM, steve donovan <> wrote:
> On Sun, Sep 8, 2013 at 4:47 PM, Seppl Vorderhörer
> <> wrote:
>> 99% of all programmers seen as) "operations that use conditions and result
>> in other conditions" are here really misused to not return booleans but
>> other types.
> Using 'or' like this is a popular Lua idiom, often used for default values:
> function foo(a,b)
>    a = a or 'one'
>    b = b or 'two'
>   ...
> end
> It is a _little_ odd at first, but then very liberating.

Indeed I like the or version a lot. I cannot bring myself to use 'and'
though, even when the alternative is verbose.