我想尝试比较两个变量容量和数量,但我不知道如何访问数据。我将包括游戏中的屏幕截图。这是代码:
t=peripheral.wrap("left")
local infoTable = t.getTankInfo("west")
print(infoTable.capacity)
该函数返回以下内容。
{
{
capacity = 16000,
contents = {
id = 0;
amount = 0,
},
},
}
编辑:我明白了。它是一张桌子。所以要访问它。
infoTable[1].capacity
对于 cotents 表
infoTable[1].contents.amount
http://puu.sh/gtzX9/acc0839b11.jpg
http://puu.sh/gtzZW/6b2aa52f12.jpg