lua-users home
lua-l archive

Re: Table constructors

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


> t = { 42, name = "bob", 45, color = "blue" }
> 
> and would be equivalent to:
> 
> t = { 42, 45 }
> t.name = "bob"
> t.color = "blue"
> 
	At first, I thought you'll propose equivalence to:
t = { [1] = 42, name = "bob", [3] = 45, color = "blue" }
	Well I think it can make some confusion. And if you type
something wrong, like
t = { 42, name , "bob", 45, color = "blue" }
	Then your table will become very different, isn't it?
	Tomas

AltStyle によって変換されたページ (->オリジナル) /