Little zl help?
i'm working on some list management (just need to compare a float to a list) and i think zl lookup or zl compare might help me. i'm using max4.6 and unfortunately those two objects aren't in the help file or the documentation. could someone post a simple example patch so i can see how these are used correctly? thanks!
drew
How do you define equality for your float and list data? By the first element or any other element? If you don't know how to explain, please post examples.
i need to check an incoming float against every number stored in a coll object to prevent duplicates. ignoring the index (since that has to be an int), the first number after the comma is my list. this may help
if you really just need yes/no why not just send a "dump" to your coll and then unpack your list (you only need your first element, right?) then into a [== 0.] into a [sel 1] voila, there you have a bang when you have a duplicate...
this definitely works, thanks! but i guess i need more than a simple yes/no. i need to replace the line based on that first element. the dump command doen't pass on the index, which i need to replace the line.
i've pulled this off by changing the float to a symbol, but that creates other issues.
i guess the ideal object would be an one that stores lists and can index with a float. haven't seen anything like that on maxobjects. any thoughts?
drew
there has been a post earlier this week, I think, about using floats as indices... have a quick search, maybe that will be helpful.
if dump doesn't work for you use the "length" message to get the number of items (you might need a second coll with the same name so your numbers don't get crossed), then use [uzi] to step through your coll as fast as possible. since you will be using the index of the uzi to step through the coll you know what index you are looking at. put the index of uzi into an [int] object and use the bang from the above example to get the index when your float is present. now you are free to do with the index number whatever you want to.
hope this helps
How about something like this which stores the index, checks the first item in the list and only sends the index if it is a match. You could then use the "remove" or "nsub" message to [coll] to delete or modify the original stored list.
lh
Thanks Luke... how could I have missed the second outlet!!! So simple!!
definitely thank you both! this is gonna help a lot. though i am still curious about zl lookup and compare. are those examples in the zl help files in max 5?
I believe they are Max5 features. Time to upgrade :)