【发布时间】:2012-05-12 10:50:46
【问题描述】:
现在我正在做一些测试,但我似乎找不到这段代码有什么问题 - 知道吗?
function IATetris(Pieza,Rotacion,Array)
io.write("The table the script received has: ",Pieza,"\n")
RotacionInicial = Rotacion
PosInicial = 7
final = #Array --this gets the size of the array
i = 1
for y = 1, 20 do --the array of my tetris board is 20 in x and 14 in y so it would be something like this Array2D[20][14]
io.write(" First for y ",y,"\n")
Array2D[y]={} --clearing the new array
for x = 1,14 do
io.write(" First for x ",x,"\n")
if i == final then break end
io.write(" First for i",i,"\n")
Array2D[y][x] = Array[i]
i= i+1 --seems like you cant use i++ in lua
end
end
end
我正在做的是获取 2 个整数和 1 个数组。我必须在控制台中写入以检查程序实际运行的位置,而我得到的是......
第一条日志消息:"The table the script received has: "
第二条日志消息:" First for y "
但我没有比那些更进一步,所以程序可能在那里崩溃了?这个函数每隔 20 秒左右就会被调用一次。我真的不知道为什么会这样。任何帮助将不胜感激,谢谢。
【问题讨论】:
标签: arrays function for-loop lua lua-table