Posted 25 January 2014 - 04:30 PM
I have a program that is supposed to read the total amount of iridium in a chest, then phone home to my server, so I can check my UU progress anywhere.
Unfortunately, this throws an attempt to index nil error on line 7.
What am I doing wrong?
The setup is as follows: openperipheral installed, vanilla chest on the left of the computer.
The serverside portion works FINE with manual requests
Unfortunately, this throws an attempt to index nil error on line 7.
What am I doing wrong?
The setup is as follows: openperipheral installed, vanilla chest on the left of the computer.
p = peripheral
c = p.wrap("left")
while true do
local totalUU = 0
for i=1, 27 do
local temp = c.getStackInSlot(i)
if temp["qty"] ~= nil then --THIS IS LINE 7
totalUU = totalUU + temp["qty"]
end
temp = nil
end
--this is a demo thing and will 404, but we don't care!
http.get("http://computercraft.info/update-uum.php?uum="..totalUU)
print("told the server about my amazing "..totalUU.." iridium ore!")
totalUU = 0
sleep(180)
end
The serverside portion works FINE with manual requests