Difference between revisions of "User:Vegas Silverweb/Fastest And Probably Most Efficient Way To Reverse a List (in Mono)"
Jump to navigation
Jump to search
(Created page with 'As Seen in Scripts <lsl> list newlist; list oldlist = ["a","b","c"]; while(oldlist !=[]) {newlist+=llList2List(oldlist,-1,-1);oldlist = llDeleteSubList(oldlist,-1,-1);} // old...') |
|||
Line 9: | Line 9: | ||
// oldlist is now empty, newlist is ["c","b","a"] | // oldlist is now empty, newlist is ["c","b","a"] | ||
</lsl> | </lsl> | ||
(of course the real fastest way to reverse a list is to just iterate over it from end to front) |
Latest revision as of 21:38, 20 April 2010
As Seen in Scripts
<lsl> list newlist; list oldlist = ["a","b","c"];
while(oldlist !=[]) {newlist+=llList2List(oldlist,-1,-1);oldlist = llDeleteSubList(oldlist,-1,-1);}
// oldlist is now empty, newlist is ["c","b","a"] </lsl>
(of course the real fastest way to reverse a list is to just iterate over it from end to front)