CC: Tweaked

CC: Tweaked

42M Downloads

inventory.list() for turtles inventory

BrunoZockt opened this issue ยท 2 comments

commented

For peripheral inventorys there is the very nice function list(), which lists all the items contained in that inventory.
It would be very useful to have that same function for the turtles own inventory (so as part of the turtle API).
Obviously custom functions can be written easily to achieve the same but it seems a little inconsistent to provide such a function for external but not for the internal inventory.

commented

You can write your own implementation of this with the tools that CC has already given you.

Fair warning with this link, I wrote it back when Plethora was providing the generic inventory interface so this might need changes to work with modern CC.

https://github.com/Lupus590-CC/CC-Random-Code/blob/master/src/turtleGenericInventoryProxy.lua#L15

commented

Thank you, but I already knew and am doing that as mentioned in my original post.
I just think that it's weird that there is a different API for external and the internal inventory.
Is there a reason apart from organic growth why this inconsistent behaviour exists?

I propose that there should be an object turtle.inventory that can be treated just like a chest returned by peripheral.find()