Re: pairs function in lua
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: pairs function in lua
- From: steve donovan <steve.j.donovan@...>
- Date: 2009年7月10日 13:30:28 +0200
On Fri, Jul 10, 2009 at 1:22 PM, <abdul.shaik@wipro.com> wrote:
> slot_tbl = { 1="ONE",2="TWO"...}
Well, this is actually a syntax error; you can only put the keys like
this if they are valid identifiers. Now, what do you want this to
say:
1) {[1]="ONE",[2}="TWO"}
2) {["1"]="ONE",["2"]="TWO"}
These are very different. If it's 1), then why not say?
3) {"ONE","TWO"}
If using numeric keys like this, and you _do_ want the order, then use ipairs
steve d.