Posted 09 May 2014 - 08:14 PM
So I found this pastbin code from a thread on this forum: http://pastebin.com/qzwqx84r
It no longer works because it uses an old version of getTanks instead of getTankInfo. I am trying to revise it.
I created the following program to understand how the table works:
It produces:
That pastebin code has the following:
How do I get the information into that format appropriately? Obviously I will need to change:
I don't think the
It no longer works because it uses an old version of getTanks instead of getTankInfo. I am trying to revise it.
I created the following program to understand how the table works:
local valve = peripheral.wrap("bottom")
local tank = valve.getTankInfo("bottom")
for key, value in pairs(tank) do
print(key .. " = " .. tostring(value))
for a,b in pairs(value) do
print(a.." "..B)/>/>
end
end
It produces:
1 = table: 2aa0101
rawName Water
amount 5600000
capacity 5600000
name water
id 1
That pastebin code has the following:
local function tankStats(tank)
if(tank) then
local amt = tank["amount"]
local size = tank["capacity"]
local filled = (amt and 1 / (size / amt)) or 0
return amt, size, filled
else
return nil;
end
end
and
local kind = tank["name"]
How do I get the information into that format appropriately? Obviously I will need to change:
local tank = valve.getTanks("back")[1]
to
local tank = valve.getTankInfo("back")[1]
I don't think the