InvRef:contains_item() Indices

Post Reply
Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

InvRef:contains_item() Indices

by Temperest » Post

Currently InvRef:contains_item() returns true if the item was found, and false otherwise. I suggest that this be augmented, so that it returns the index of the item (or 0 if it was not found).

Alternatively, to preserve backwards compatibility, there could be an InvRef:find_item() function.

This is useful when modifying item stacks that have wear and other data associated with them. For example, detecting if an item stack exists and has full durability.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Badkraft
Member
Posts: 28
Joined: Wed Jan 27, 2021 13:44

Re: InvRef:contains_item() Indices

by Badkraft » Post

So, this would be a great idea. Are we going to see any discussion on this?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: InvRef:contains_item() Indices

by runs » Post

I thought the same in the past. Make a request in github.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests