lua-users home
lua-l archive

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


Thinking out loud, I came to need the following feature, assigning at parser time (read-time) the same value to mulitple keys:

Instead of

local t1 = {
   v1 = 10,
   v2 = 10,
   v3 = 10
}

Something like

local t1 = {
    v1 = v2 = v3 = 10
}

Would that be possible to implement.

It's useful in cases where lua is used for configuration/description language, and multiple keys match the same value. For example when describing configurations for something, and instead of duplicating values you can attach them at the same key, like this very simple example:

local conf = {
   windows = "cmd.exe",
   osx = linux = "sh"
}

I don't know whether this is going to work in all cases, or whether it carries some parsing gotcha.

Thanks,
Dimiter 'malkia' Stanev.

On 11/30/2012 6:09 AM, Erik Hougaard wrote:
Hi List,

Later today Roberto will do a Q&A (Or perhaps a AMA) - So if you have
burning questions for Roberto, this is your time to ask them, either on
the list or directly to me. I will redirect your questions to Roberto.

(Everything is getting recorded, so answer will be in the videos
released later)

/Erik