Jump to content

ListReplaceList problem


Marioni Unplugged
 Share

You are about to reply to a thread that has been inactive for 4292 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

suppose i have the following:

list1 is [1,5,9] and list2 is [0,2,1]

now, while list1 contains values, i want list2 to be indexes, that will be used to replace list1, using the same values, but with the order changed, as dictated by list2. So in this example list1 should become [1,9,5].

any ideas as to how to achieve this? llListReplaceList? Then how?

 

thx, Marioni

Link to comment
Share on other sites

  Here's one way ...

default{    touch_start(integer total_number)    {        list list1 = [1,5,9];        list list2 = [0,2,1];        llSay(0,llList2CSV(list1));        integer i;                list temp;                for (i=0; i< (list1 !=[]);++i)                {                    integer idx = llList2Integer(list2,i);                    temp += [ llList2Integer(list1,idx) ];                }                list1 = []+ temp;                llSay(0,llList2CSV(list1));    }}

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4292 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...