[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Thoughts on optional commas
- From: Greg <tghill@...>
- Date: Sat, 3 Mar 2012 13:11:32 +0000 (UTC)
Occasionally I forget commas when I create large nested tables in Lua. It
reminds me of when I was learning c and always forgetting to place semicolons at
the end of a line. I'm so happy that semicolons are optional in Lua. I wish
commas were too.
Could this work?
Example:
local node= {
{template="window"
{template="rect" x=10 y=100 alpha=1
s1 = {color="red"}
s2 = {color="blue" x="=x+1"}
s3 = {color="blue" x=10}
}
{template="textbox" }
}
}
Instead of traditionally:
local node= {
{template="window",
{template="rect", x=10, y=100, alpha=1,
s1 = {color="red",},
s2 = {color="blue", x="=x+1",},
s3 = {color="blue", x=10,},
},
{template="textbox", },
},
}
I always end up using trailing commas in my tables and it feels wasteful.
Any thoughts?