Marioni Unplugged Posted July 27, 2012 Share Posted July 27, 2012 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 More sharing options...
Rolig Loon Posted July 27, 2012 Share Posted July 27, 2012 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 More sharing options...
Marioni Unplugged Posted July 27, 2012 Author Share Posted July 27, 2012 wow, never even thought of a temp list ;-) pretty nifty solution, you're the best!!! ...and such a fast reply too much obliged! marioni Link to comment Share on other sites More sharing options...
Recommended Posts
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