Lua学习十----------Lua数组
© 版权声明:本文为博主原创文章,转载请注明出处
1.LUA数组
- 一维数组
- 多维数组
2.array.lua
-- 一维数组 print("一维数组") array1 = {"Lua", "Tutorial"} for i = 0, 2 do print(array1[i]) end -- 二维数组 print("二维数组") array2 = {} for i = 0, 3 do array2[i] = {} for j = 0, 2 do array2[i][j] = i * j + i + j end end for i = 1, 3 do for j = 1, 2 do print(array2[i][j]) end end
3.效果预览
© 版权声明:本文为博主原创文章,转载请注明出处