Difference between revisions of "ListStridedMove"

From Second Life Wiki
Jump to navigation Jump to search
(it had nothing to do with strides.)
Line 1: Line 1:
{{LSL Header}} __NOTOC__
{{LSL_Function
<div id="box">
|mode=user
== Function: [[list]] ListStridedMove([[list]] {{LSL Param|myList}},
|func=ListStridedMove
[[integer]] {{LSL Param|place}}, [[integer]] {{LSL Param|newplace}} ) ;
|p1_type=list|p1_name=myList
==
|p2_type=integer|p2_name=start
<div style="padding: 0.5em;">
|p3_type=integer|p3_name=end
Moves something in a strided list to another place in the strided list.
|p4_type=integer|p4_name=stride
|p5_type=integer|p5_name=target
|return_type=list
|return_text=that is myList with the strides in the range of '''start''' to '''end''' moved to the stride position '''target'''.
|func_desc=Moves a stride from one position to another position.
|func_footnote=
<lsl>list ListStridedMove(list myList, integer start, integer end, integer stride, integer target) {
    if(stride <= 0) stride = 1;
    list item = llList2List(myList, start *= stride, end *= stride);
    return llListInsertList((myList = []) + llDeleteSubList(myList, start, end), item, destination * stride);
}</lsl>


See also: [[List#Strided_lists|Strided Lists]]
See also: [[List#Strided_lists|Strided Lists]]
 
|spec
<lsl>
|helpers
list ListStridedMove(list myList, integer place, integer newplace) {
|also_functions
    string item = llList2String(myList, place);
|also_events
    myList = (myList=[]) + llDeleteSubList(myList, place, place);
|also_tests
    myList = (myList=[]) + llListInsertList(myList, (list)item, newplace + (newplace > place));
|also_articles
    return myList;
|notes
}
|cat1=Example
</lsl>
|cat2
 
|cat3
 
|cat4
</div>
}}
 
{{LSLC|Examples|ListStridedMove}}

Revision as of 17:16, 14 July 2008

Summary

Function: list ListStridedMove( list myList, integer start, integer end, integer stride, integer target );

Moves a stride from one position to another position.
Returns a list that is myList with the strides in the range of start to end moved to the stride position target.

• list myList
• integer start
• integer end
• integer stride
• integer target

<lsl>list ListStridedMove(list myList, integer start, integer end, integer stride, integer target) {

   if(stride <= 0) stride = 1;
   list item = llList2List(myList, start *= stride, end *= stride);
   return llListInsertList((myList = []) + llDeleteSubList(myList, start, end), item, destination * stride);

}</lsl>

See also: Strided Lists

Examples