Probably a slow moment here…
I would expect this one to return “5” and not “-1” (item not found)
[Item Index] only ‘finds’ identical values if they reside at the exact same location in memory. In this case, the text in the list and the text you’re searching for are indeed the same text, but they are stored in different memory locations.
You’ll want to use the Set components [Member Index] instead, which is clever enough to compare different instances for equality, but note that it only understands simple data types such as booleans, numbers, points, text, colours, etc. it doesn’t know how to compare curves, meshes, breps and other complex stuff for equality.
That works. Thanks David!
My first use of a Set component!
It’s a very common mistake people make with Item Index. I’m hesitant to change it now because it might invalidate a lot of tutorials and lecture materials, but it should have been called [Memory Compare] just to scare people away from it.
That would have scared me away, yes.
Aaaand, tonight’s horror movie: Memory Compare.
Sorry for the necromancy,
but you should at least add the above explanation to the Help of the component, because nothing about suggests the way it actually works.