lua-users home
lua-l archive

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

Just let me return you the question: why you would really not like
something like this to happen?

I think that conditional expressions are extremely useful when it deals
with configuration which is the initial aim of Lua after all. If
properly use it can make the code more readable, especially for non
To my mind, a high level programming language's goal is to make thing as
close as possible to natural language.

So, I would prefer to be able to write something like (VHDL flavor, and
yet another even more disturbing keyword :-) knowing that if elseif...
could be reused)
style = "native"
a = { a = 1,
      b = { b = 2,
            c = 1 when style == "native",
                2 when style == "rock",
                0 else
rather than
style = "native"
a = { a = 1,
      b = { b = 2,

if style == "native" then
  a.b.c = 1
elseif style == "rock" then
  a.b.c = 2
  a.b.c = 0


style = "native"
a = { a = 1,
      b = { b = 2, c = f(style)
function f(style)

which disseminates the code, and well looks like coding.

But this has probably a noticeable impact on grammar. But I wonder, how
many people with hard size constraints really embed lua compiler? 

-----Original Message-----
[] On Behalf Of Vyacheslav
Sent: Tuesday, September 19, 2006 4:45 PM
To: Lua list
Subject: Re: Default value in function parameters?

Grellier, Thierry wrote:
> Maybe "else' is a better choice.
Take a look at this
Do you really want something like that happen with Lua?