How I can use the clear-method?
I tried: glob.chest.cleared() but I got an "invalid key"- error...
Anyway, maybe there is a better way to achieve what I want.
I want to check if a specific chest contains a specific item, if yes then his amount should be decreased by one.
What I tried so far:
Code: Select all
if glob.chest.getitemcount("coal") > 0 then
local coal =glob.chest.getitemcount("coal")
local wood = glob.wood.getitemcount("raw-wood")
glob.chest.cleared()
coal=coal-1
glob.field[i].insert{name="coal", count= coal}
glob.field[i].insert{name="raw-wood", count=wood}
end
Code: Select all
if glob.chest.getitemcount("coal") > 0 then
glob.field[i].insert{name="coal", count= -1}
end

Second version isnt better. After a huge lag the invetory is completly full
