Replace items wrap bug?

2019-10-11%2013_59_24-Window
Replace_items_bug.gh (8.0 KB)

Hi all!
The trick of using -1 index to “select” the last item of a list… doesn’t work with Replace items component.
Is this a bug?
Am I doing something wrong?

2 Likes

Use ListLength-1 instead?

Using “-1” index is simple and precise.
Having to pick list length would be using one additional input, which is not convenient.

A single “-1” index with a single item for replacing, works.
It doesn’t with many indexes/items.


Replace_items_bug2.gh (9.6 KB)

Seems like there are more problems…

Hello ; how this wrong and the other correct? both of them look wrong and i don’t think replace items worked like that, items must replaced with precise indices and length of list to modify >= length of lists of items to replace with, or you have a different point?

Green is correct because the index used are just “1”, so only the second element of the original list is modified.
“CC” is the last of the “I” input, to that’s the one remaining.
Totally expected result, for me.

Red is wrong because the value “2” of the original list, which is the third element (index=2), is replaced! … even when i never used an i=2 index for replacing.
Even worse, original list length was 3, the output have a length of 4 … replacing should not increase or decrease the length of the list it is working on…

Hi Riccardo when you use a list of items with Replace i you must use -2 to replace the last item. This method just works only with this component.
On the other hand, when is a single value this work as expected :man_shrugging:.

3 Likes

Emm but why?

1 Like


2 Likes

I feel it’s weird too. Seems to be the only list component that doesn’t accept negative indices.

Wrap must be True

2 Likes

Oh man. I’ve totally overseen that it’s false by default, unlike the others.
Thanks Thomas!