lua-users home
lua-l archive

assignment syntax in tables

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


Hi,
according to the reference manual multi-assignment is possible, eg,
x, y = 1, 2;
Does this apply within tables as well? eg,
table = {
	x, y = 1, 2;
}
Running this through lua and printing the table gives me
2 = 2
y = 1
which is not what I expected... Am I misunderstanding something or is the only way to do this to declare the table
table = {};
and then place into it
table.x, table.y = 1, 2;
which does do the right thing, but is not what I was trying to do
-Marc

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