Structure sort question

psonice's picture

I have a question on structure sorting, perhaps somebody can help.

I'm creating a bunch of structures with queues. Then, I feed all of the structures into a javascript patch, and combine them into a new 'structure of structures, using something like:

struct[0] = input0; struct[1] = input1; ... etc. and returning struct. It works fine, but the output structure is in some random order! I've tried using "struct['a']" and so on, it's no different, I see 0: 'e' structure.. then 1: 'k' structure etc.

I've tried using the structure sort patch, but I'll be damned if I can figure it out. Leaving it without a descriptor, the input is e,k,.. and the output is p,e,... The same thing happens with numbers.

Any ideas? Is this some kind of bug? It sure doesn't look 'expected' :/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

DanieleCiabba's picture
the same problem for me..

the same problem for me... I can't understand how to sort the structure...

psonice's picture
structure progress

I made some progress with this actually. If you're using say a big structure and want to access by index, but it's in a random order, you can use the 'key member' patch instead and give it the index number. It'll then at least get the right element from the structure.

You can also select by index the same way in javascript if you're processing a struct.. that's good for combining structs or processing them, but the output structure will still be unsorted!