This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
doublequestionmark's profile picture

Is it possible to put an array inside of an array?

Started by doublequestionmark, 17 June 2015 - 02:24 AM
doublequestionmark #1
Posted 17 June 2015 - 04:24 AM
Is it possible to put an array inside of an array?

for example:


{"{"foo", "bar"}", "{"barfoo", "foobar"}"}
Bomb Bloke #2
Posted 17 June 2015 - 04:39 AM
Yes, but you generally wouldn't declare your sub-tables as strings.

local myTable = {{"foo", "bar"}, {"barfoo", "foobar"}}

print(myTable[1][1])  --> foo
print(myTable[1][2])  --> bar
print(myTable[2][1])  --> barfoo
print(myTable[2][2])  --> foobar
Edited on 17 June 2015 - 02:40 AM