Passing a 2d array to work in Lua
Is it possible to pass an array to a 2d function as a parameter? I have initialized the array like this:
tab={}
for i=1, 10 do
tab[i]={}
for z=1, 10 do
tab[i][z]= 0
end
end
and I have a function like this:
function foo(data)
...
x = data[i][z] -- here i got error
...
end
An error message is given attempt to index field '?' (a nil value)
All variables are declared and initialized.
+2
source to share