Posted 11 April 2013 - 02:05 PM
I am trying to get data stored in a multi-layer table, a snippet of which looks like:
I would like to access the "value's" by using two numbers. For example, the number set 1,1 would return "value", and 2,1 would return "value3". I can do this by a very inelegant method:
Is there a way to access the value with one line? Something like 'table[x].y'?
Thanks!
table = {
[1] = {
[1] = "value";
[2] = "value2"
},
[2] = {
[1] = "value3";
[2] = "value4"
}
}
I would like to access the "value's" by using two numbers. For example, the number set 1,1 would return "value", and 2,1 would return "value3". I can do this by a very inelegant method:
-- Let x and y be the two numbers.
tHolder = table[x]
print(tHolder[y])
Is there a way to access the value with one line? Something like 'table[x].y'?
Thanks!