Comment by IshKebab
1 year ago
> I'm not sure if I missed a point you were getting at with this? Lua array table indexes start at 1.
The code example is
mt = {} -- create the matrix
for i=1,N do
for j=1,M do
mt[i*M + j] = 0
end
end
What index do I use to access the first element in mt? It isn't 1!
If this was written using 0-based indices then the answer would be zero.
No comments yet
Contribute on Hacker News ↗