Notifications
Clear all

[Closed] MaxScript: how to make unique arrays that are inside another array?

How to make unique arrays that are inside another array?

There is an original array like this:

myArray=#(#("My string 1",1,2,3),#("My string 2",1,2,3,4),#("My string 2",1,2,3)#("My string 1",1,2,3),#("My string 2",1,2,3))

He must become like this:

myArray=#(#("My string 1",1,2,3),#("My string 2",1,2,3,4),#("My string 2",1,2,3))

That is, internal arrays should not be repeated.
The standard makeUniqueArray myArray method does not work in this case.

Thanks for any help.

2 Replies

Maybe there’s another better method available. I’d also like to know.

arr              = #(  #("one", 1,2,3 ), #("one", 1,2,3 ), #("two", 1,2,3 )  )
unique_arr_items = (hashes = #(); for item in arr where appendifunique hashes (gethashvalue item 0) collect item)

Thank you Serejah!
You help me as always