1 local array = {}; 2 local row1 = { 1 , 3 , 5 , 7 , 9 } 3 local row2 = { 2 , 4 , 6 , 8 , 10 } 4 local row3 = { " I " , " love " , " lua " } 5 array[ 1 ] = row1; 6 array[ 2 ] = row2; 7 array[ 3 ] = row3 8 print ( " length = " , # array); 9
1 local array = {}; 2 local row1 = {1, 3, 5, 7, 9} 3 local row2 = {2, 4, 6, 8, 10} 4 local row3 = {"I", "love", "lua"} 5 array[1] = row1; 6 array[2] = row2; 7 array[3] = row3 8 print("length = ", #array); 9 for i = 1, #array do 10 for j = 1, #array[i] do 11 print(array[i][j]) 12 end 13 end