[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: 2d arrays
- From: "Tim Royal (ArtSource)" <a-tiroya@...>
- Date: Wed, 18 Jun 2003 11:20:25 -0700
What kind of errors are you seeing?
If I run your example, it works fine for me. Example:
print(array["a"]["a"][1]) -- returns 1
print(array["a"]["b"][1]) -- returns 1
print(array["b"]["a"][1]) -- returns 2
print(array["b"]["b"][1]) -- returns 2
Is it possible that you don't want the "{}" around the values 1 and 2
below?
Tim
-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of orangeted
Sent: Wednesday, June 18, 2003 11:08 AM
To: lua mailing list
Subject: 2d arrays
I'm trying to make a 2d array which uses strings as indices. I've tried
this
but i get errors. what am I doing wrong?
array = {a,b}
array["a"] = {}
array["b"] ={}
array["a"]["a"] = {1}
array["a"]["b"] = {1}
array["b"]["a"] = {2}
array["b"]["b"] = {2}