I know tcc probably is not designed to be anywhere near Python or similar programing languages, but I tried to use arrays in a batch file nevertheless. My current problem is that I want to sort an array for a key, but the function I clumsily wrote with tcc takes ages to complete and I'm not able to code a multilayer quicksort (plugin authors, anyone?).

My actual application for this is to sort a long list of image metadata first according to the rating, and then according to the date/time (I converted the latter to age, so it's a simple numeric value).

If this won't happen, does anyone know of a smart method to sort something like this simple example array ...

array[0,0,0]=2

array[0,0,1]=100

array[0,0,2]=blablabla

array[0,1,0]=3

array[0,1,1]=100

array[0,1,2]=yadayada

array[0,2,0]=1

array[0,2,1]=300

array[0,2,2]=secondary

array[0,3,0]=1

array[0,3,1]=200

array[0,3,2]=primary

... in numeric order of the given array keys, in this case the first [n,n,0]

%array[0,0,0]: 1

%array[0,0,1]: 200

%array[0,0,2]: primary

%array[0,1,0]: 1

%array[0,1,1]: 300

%array[0,1,2]: secondary

%array[0,2,0]: 2

%array[0,2,1]: 100

%array[0,2,2]: blablabla

%array[0,3,0]: 3

%array[0,3,1]: 100

%array[0,3,2]: yadayada

Thanks for any hints!

My actual application for this is to sort a long list of image metadata first according to the rating, and then according to the date/time (I converted the latter to age, so it's a simple numeric value).

**Feature request**: @ARRAYSORT[arrayvar, arraykey1, ...] to sort an array according to numeric value of the specified key(s)If this won't happen, does anyone know of a smart method to sort something like this simple example array ...

array[0,0,0]=2

array[0,0,1]=100

array[0,0,2]=blablabla

array[0,1,0]=3

array[0,1,1]=100

array[0,1,2]=yadayada

array[0,2,0]=1

array[0,2,1]=300

array[0,2,2]=secondary

array[0,3,0]=1

array[0,3,1]=200

array[0,3,2]=primary

... in numeric order of the given array keys, in this case the first [n,n,0]

**and then the second**[n,n,1]]? The result should be ...%array[0,0,0]: 1

%array[0,0,1]: 200

%array[0,0,2]: primary

%array[0,1,0]: 1

%array[0,1,1]: 300

%array[0,1,2]: secondary

%array[0,2,0]: 2

%array[0,2,1]: 100

%array[0,2,2]: blablabla

%array[0,3,0]: 3

%array[0,3,1]: 100

%array[0,3,2]: yadayada

Thanks for any hints!

Last edited: