[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua as Configuration Conditional Statement inside table definition
- From: Axel Kittenberger <axkibe@...>
- Date: Wed, 10 Nov 2010 09:07:37 +0100
If this is a compiletime switch and you cannot live with changing the
table on runtime like Francesco suggested, metalua
http://metalua.luaforge.net/ looks like a tool for you
On Wed, Nov 10, 2010 at 9:02 AM, Francesco Santini <rincewind@tin.it> wrote:
> Il 10/11/2010 08:45, Gopalakrishnan Subramani ha scritto:
>>
>> Hello All,
>
> Hello list,
>
> I take this chance to end my lurking period and say hi to everybody. I'm no
> big expert so I apologize if my solution is naive:
>
>> Here I am start with simple example of definition the enumeration.
>>
>> Enum1 = ENUMERATION {
>> {1, "Forward"},
>> {2, "Backword"},
>>
>> if BIDIERCTIONAL_SUPPORTED then
>> {3, "BiDirectional"},
>>
>> {4, "None" }
>> }
>>
>> If you see, the "Bidirectioanl" is added only if it is enabled. I don't
>> think, Lua support statements within the table definition.
>>
>> Can you help me different possibilities in Lua to resolve this issue?
>
> Why don't you just define the table without the third element, and insert it
> afterwards conditionally?
>
> Enum1 = ENUMERATION {
> {1, "Forward"},
> {2, "Backword"},
> {4, "None" }
> }
>
> if BIDIRECTIONAL_SUPPORTED then
> table.insert(Enum1, 3, {3, "BiDirectional"})
> end
>
> HTH
>
> Francesco
>
>