feldim2425 / OC-Minecarts

Minecraft Mod / Addon for OpenComputers
MIT License
10 stars 4 forks source link

Error in inventory count #16

Closed dustpuppy closed 8 years ago

dustpuppy commented 8 years ago

Hi, i've found an error in the count() method. Not easy to explain :-) Source is :

local component = require("component") local cart = component.computercart for i = 1, cart.inventorySize() do print(i, cart.count(i)) end

The first slot (i=1) will give an error "no slot selected". So i did it from 2. Count is not starting at slot 1. It goes from slot 2 to inventorySize + 1. Possible picture will explain it better ;-) bildschirmfoto13

feldim2425 commented 8 years ago

In my test it throws an error ("invalid slot"). "no slot selected" means that you called count() without arguments and the selected slot is invalid.

But you are right the slot index is one off. I will fix that.

feldim2425 commented 8 years ago

Fix in version 1.6