Difference between revisions of "ListStridedMove"

From Second Life Wiki
Jump to: navigation, search
(New page: {{LSL Header}} __NOTOC__ <div id="box"> == Function: list ListStridedMove( list {{LSL Param|dest}}, list {{LSL Param|src}}, integer {{LSL Param|start}}, integer {{LSL ...)
 
Line 1: Line 1:
 
{{LSL Header}} __NOTOC__
 
{{LSL Header}} __NOTOC__
 
<div id="box">
 
<div id="box">
== Function: [[list]] ListStridedMove( [[list]] {{LSL Param|dest}}, [[list]] {{LSL Param|src}},  
+
== Function: [[list]] ListStridedMove([[list]] {{LSL Param|myList}},  
[[integer]] {{LSL Param|start}}, [[integer]] {{LSL Param|end}}, [[integer]] {{LSL Param|stride}} ) ;
+
[[integer]] {{LSL Param|place}}, [[integer]] {{LSL Param|newplace}} ) ;
 
==
 
==
 
<div style="padding: 0.5em;">
 
<div style="padding: 0.5em;">
Line 10: Line 10:
  
 
<lsl>
 
<lsl>
list ListStridedMove(list myList, integer src, integer dest) {
+
list ListStridedMove(list myList, integer place, integer newplace) {
     string item = llList2String(myList, src);
+
     string item = llList2String(myList, place);
     myList = (myList=[]) + llDeleteSubList(myList, src, src);
+
     myList = (myList=[]) + llDeleteSubList(myList, place, place);
     myList = (myList=[]) + llListInsertList(myList, (list)item, dest + (dest > src));
+
     myList = (myList=[]) + llListInsertList(myList, (list)item, newplace + (newplace > place));
 
     return myList;
 
     return myList;
 
}
 
}

Revision as of 10:38, 13 July 2008

== Function: list ListStridedMove(list myList, integer place, integer newplace ) ; ==

Moves something in a strided list to another place in the strided list.

See also: Strided Lists

<lsl> list ListStridedMove(list myList, integer place, integer newplace) {

   string item = llList2String(myList, place);
   myList = (myList=[]) + llDeleteSubList(myList, place, place);
   myList = (myList=[]) + llListInsertList(myList, (list)item, newplace + (newplace > place));
   return myList;

} </lsl>