[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table constructors
- From: David Jeske <jeske@...>
- Date: Sun, 29 Aug 1999 10:31:27 -0700
On Sun, Aug 29, 1999 at 05:49:40AM -0300, Ashley Fryer wrote:
> I'm curious, is there some reason why the two types of table field
> initialization lists can't be merged?
I think this is an RTFM..
> This would become legal syntax:
>
> t = { 42, name = "bob", 45, color = "blue" }
Just do:
t = { 42, 45 ; name = "bob", color = "blue" }
For some justification of why the numbered and keyed parts have to be
separated, see this message from the archive:
http://www.egroups.com/group/lua-l/296.html?
FYI: you can also do:
t = { [1] = 42, ["name"] = "bob", [2] = 45, ["color"] = "blue" }
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net