local ingredients = {"cobblestone"} local results = {} local furn = peripheral.wrap("furnace_0") for i,v in pairs(furn.getStackInSlot(3)) do results[i]=v end if results["qty"] > 0 then print("output found") else print("Error: no output found") end
This is for a computercraft controlled auto furnace while I get the hang of using tables.
The problem i'm running into is that it keeps throwing an error when the output slot of the furnace is empty, works good so long as the output has something
THis is what happens when the output is empty:
<program name>:7: bad argument, table expected, got nil.
the following code just seems to throw my custom error regardless.
local ingredients = {"cobblestone"} local results = {} local furn = peripheral.wrap("furnace_0") if pcall(furn.getStackInSlot(3)) then for i,v in pairs(furn.getStackInSlot(3)) do results[i]=v end if results["qty"] > 0 then print("output found") end else print("Error: no output found") end
What am i missing?
Edited by CreeperGoBoom, 18 December 2018 - 01:59 PM.