lua-users home
lua-l archive

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

On Wed, Nov 10, 2010 at 1:42 PM, Luiz Henrique de Figueiredo
<> wrote:
>> at _run-time_.  Otherwise, the condition variable is evaluated at
>> compile-time.
> What?

OK. 'compile time' is not a well-defined concept for Lua ;)

T = {
one = 1,
two = CONDITION and 2 or nil,
three = 3

That evaluates directly, when the config file is parsed and executed.

If you wanted it to evaluate in some later context, then it would have
to be quoted.

two = function() return CONDITION and 2 or nil end

and any function values evaluated later.

It's not clear from the OP when the actual condition should be
evaluated. I'd say that having to quote things makes things
complicated and depends on elaborate state management. Lazy evaluation
is not easier.

steve d.