stanek
(Stanek)
August 20, 2020, 2:55am
1
Hello! I am am working with a list of letters, where each is unique. When I try and use letters from another list to get the index numbers of the letters in the first list using “Item Index”, I make no matches. I can only get indexes back if I feed the original list into itself.
Is there some trick to using letters as data items that I am missing? Please see attached file for simplest version I could build in gh. Thank you. item_index_no_match_20-0819.gh (10.0 KB)
HS_Kim
August 20, 2020, 3:25am
2
That is an expected result and not a bug. Check the linked topics.
Greetings,
I would appreciate some [Capture] help.
I’ve used grasshopper for years, but this is the first time I have been stumped so hard, as I’d have to back-track a huge script to get things to work the way they should. Somewhere along the way in my script the Item Index managed to break and no matter what sort of information I feed into it, it will give a -1 value.
Before posting: Item Index always returns -1 - I’ve looked at the forum and found different answers, but they involve not us…
[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 …
Member Index is more appropriate for finding Noot.
“the difference between [Member Index] and [Item Index] is basically that Member Index compares values, whereas Item Index compares memory addresses.”
2 Likes
stanek
(Stanek)
August 20, 2020, 4:05am
3
Thank you—didn’t find anything when searching, but I’ve got it now.