This article mainly introduces the use of a two-dimensional array in Lua, this article directly gives a code example, to see the code easier to understand, the need for friends can refer to the
As with JS in Lua, there is no concept of two-dimensional arrays, but two-dimensional arrays are extremely important to our development and, of course, are used a lot. Talk about using two-dimensional arrays in Lua?
Principle, a one-dimensional array gives a nested is a two-dimensional array, OK, so simple, look at the code easier to understand
Recently doing a project, the following is part of the code
?
1 2 3 4 5 6 7 8 |
For i=1,10 does self.startmartix[i]={} self.star[i]={} for j=1,10 do self.startmartix[i][j]= starsprite Star_ End |
This creates the Self.startmartix, the Self.star is all the two-dimensional array appearance, the visit time, Self.star[1][1] can