[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: assignment syntax in tables
- From: Reuben Thomas <rrt@...>
- Date: Mon, 13 Oct 2003 19:28:11 +0200 (CEST)
> table = {
> x, y = 1, 2;
> }
Simultaneous assignment doesn't apply to tables. Remember that table
elements can be comma-separated, so what you are actually doing is setting
table[1] = x -- probably nil, hence the result below
table[2] = 2
table["y"] = 1 -- (because you explicitly gave an index here)
> Running this through lua and printing the table gives me
>
> 2 = 2
> y = 1
And you would have a value for 1 if x were non-nil above.
--
http://www.mupsych.org/~rrt/
penitent, a. undergoing or awaiting punishment (Bierce)