blocks = {block1 = {}, block2 = {}}
blocks.block1.x = 1
blocks.block1.y = 2
blocks.block2.x = 3
blocks.block2.y = 4
我想为块表中的每个项目打印x
和y
,例如
for b in blocks do
print(b.x)
print(b.y)
end
我知道块最终会成为局部变量,但我不知道其他任何解释方法。
基本上我想要输出
>
1
2
3
4
>
答案 0 :(得分:2)