lua-users home
lua-l archive

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


RTFM 2.5.6 (in 5.0 "FM") Table Constructors.


-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Marc Nijdam
Sent: Monday, October 13, 2003 12:24 PM
To: lua@bazar2.conectiva.com.br
Subject: assignment syntax in tables


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