lua-users home
lua-l archive

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


>     Since Lua is an applicative language both branches would be evaluated.

Whenever that becomes an issue i usually wrap the branches in quotes
and evaluate them in the function depending on the condition.

Martin

On 14 September 2010 18:53, Alex Queiroz <asandroq@gmail.com> wrote:
> Hallo,
>
> On Tue, Sep 14, 2010 at 1:47 PM, Martin Voigt <voigt.m@googlemail.com> wrote:
>> Maybe I'm missing something. What's wrong with using a function for
>> the ternary use case?
>>
>> local value = ternary(condition, value_if_true, value_if_false)
>>
>
>     Since Lua is an applicative language both branches would be evaluated.
>
> --
> -alex
> http://www.artisancoder.com/
>
>