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

problem with arrays

Started by DarkShadowsX, 08 September 2013 - 09:57 PM
DarkShadowsX #1
Posted 08 September 2013 - 11:57 PM
i been having a problem with my array it seems that when i try to print or modify it, i get a
index expected, got nil error:
I checked the spelling of everything and even tried it in luaEclipes. it works perfectly in luaEclipes i should add, but not in CC.
here is my array setup:

array = {}
for aX = 1, 48 do
	 array[aX] = {}
	 for aY = 1, 48 do
		 array[aX][aY] = {}
		 for aZ = 1, 100 do
		  array[aX][aY][aZ] = 20
		 end
	 end
end
all i changed was the array name for this example
but when i try to acces/modify the array using the integer aXl for aX, aYl for aY, and aZl for aZ i get errors that i dont get in luaEclipes

aXl = 1
aYl = 2
aZl = 3
array[aXl][aYl][aZl] = 15
when i print

print(array[1][2][3])
it works fine. the problem seemes to be accesing the array with another integer.
is there anyway around this problem or am i dead in the water sorta speak…
Lyqyd #2
Posted 09 September 2013 - 12:01 AM
Split into new topic.

Please post the actual code and the full text of any error messages you're receiving.