在我的 lua 程序中,我想检查红石输入的侧面(使用 for 循环检查)。最后几行用于打印出数组的结果,作为调试工具。输出是边名,后跟 0(预期为真/假)。稍后将在程序中使用这些数据。
谢谢你。
http://www.pastebin.com/0innMjcP
function array()
a = {}
for i=1, 6 do
a[i] = {}
for j=1, 2 do
a[i][j] = 0
end
end
a[1][1]= "front"
a[2][1]= "back"
a[3][1]= "left"
a[4][1]= "right"
a[5][1]= "top"
a[6][1]= "bottom"
end
array()
for i=1, 6 do
input=redstone.getInput(a[i][1])
if input=="true" then
a[2][2]="true"
elseif input=="false" then
a[3][2]="false"
end
end
for i=1, 6 do
print(a[i][1])
print(a[i][2])
end