This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
saphyblack's profile picture

Tank Turbulence

Started by saphyblack, 12 October 2013 - 09:53 AM
saphyblack #1
Posted 12 October 2013 - 11:53 AM
Everything I've tried so far has been to no avail with tanks…I have attempted to go to the most basic thing I can, just printing the tank information so I can later manipulate the data. Unfortunately, not even the wizard of Google can seem to solve my issue. Perhaps I simply stink at looking? I'm using Open Peripherals and a Railcraft tank, with the computer directly in front of the valve. The error is an attempt to reference a nil value on the second line. Anyways, here's the code

local value = peripheral.wrap("back")
local tableInfo = valve.getTAnks("unknown")

for k, v in pairs(tableInfo) do
for x, y in pairs(v) do
print(x..":"..y)
end
end


Any help would be much appreciated! Thanks for your time, and "tanks" in advance for the help! :D/>
Lyqyd #2
Posted 12 October 2013 - 02:29 PM
Split into new topic.

You've got a few typos here. Do you want to call the variable "value" or "valve"? You should pick one and stick with it, since you use one on the first line and the other on the second. I'm also pretty sure that it's not "getTAnks", but should instead be "getTanks" for the method you're calling from it. Give that a shot and see if it fixes the issues.
DarkEspeon #3
Posted 12 October 2013 - 02:55 PM
Don't know if this is how you want it but its the best I can give you with what you gave me.
EDIT: Didn't see that this is exactly what lyqyd said, but you can copy and paste this


local value = peripheral.wrap("back")
local tableInfo = value.getTanks("unknown")

for k, v in pairs(tableInfo) do
for x, y in pairs(v) do
print(x..":"..y)
end
end