sort arrays with sortby possible?

  • Hi,

    sortby is for sorting the content inside the array. But it is also possible to sort multiple arrays based on the values in one specific entry of all arrays?

    Example: We have 10 arrays (array_count) with the same content but different values...
    Array1
    Test1=50
    Test2=Aaron
    Test3=0

    Array2
    Test1=100
    Test2=Brad
    Test3=1

    Array3....


    Code
    for(set(i,1), i LE get(array_count), inc(i),
    	txtadd(value_name,'value_',get(i));
    	txtadd(array_name,'Array',get(i),'[Test2]');
    	copy(get(value_name),get(array_name));
    );

    Now we need to check which value is lower/higher, Aaron or Brad?! But how? For numbers it´s pretty easy, but for names?! *unsure*

  • Code
    set(a,aaron);
    set(b,brandon);
    if(a LT b,trace(A_OVER_B),trace(B_OVER_A));

    works just fine. Did´nt know that LT/GT also works for text. But for arrays I think it´s much better to do it in JS with sort!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!