Hello. While working with arrays/tables I came across a problem
for x = 0, kLevelCols do
levelVisual[x] = {}
for y = 0, kLevelRows do
if level[x][y] == 2 then
--Problem comes here
if level[x-1][y] == 2 then
levelVisual[x][y] = 1
end
elseif level[x][y] == 1 then
levelVisual[x][y] = 1
else
levelVisual[x][y] = 0
end
end
end
I got 2 tables named level and levelVisual. level contains values of either 0, 1 or 2. Within the for-loop, I can access the x, y elements of level normally. However, if I try to access either x+1 or y+1, Corona tells me I try to access a nil value, even if it isn’t.
Is there anything lua sensitive that I overlooked? [import]uid: 191248 topic_id: 34991 reply_id: 334991[/import]
[import]uid: 191248 topic_id: 34991 reply_id: 139304[/import]