Difference between revisions of "ListStridedRemove"
Jump to navigation
Jump to search
(replaced the function with one that works.) |
m (minor change to function to cover sending a low start value) |
||
Line 14: | Line 14: | ||
{ | { | ||
// fixed and improved by Madpeter Zond (the wiki entry is trash please update it) | // fixed and improved by Madpeter Zond (the wiki entry is trash please update it) | ||
if((start < 1) || (stride < 1)) return src; // reverse stride not supported | |||
else | |||
if(( | |||
{ | { | ||
integer loop = start - 1; | |||
integer tricker = 0; | |||
integer maxlen = llGetListLength(src); | |||
if((end == 0) || (end > maxlen)) end = maxlen; | |||
while(loop < end) | |||
{ | |||
integer pointid = loop-tricker; | |||
src = llDeleteSubList(src,pointid,pointid); | |||
tricker++; | |||
loop+=stride; | |||
} | |||
return src; | |||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Revision as of 08:04, 16 December 2009
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: list ListStridedRemove( list src, integer start, integer end, integer stride );
Removes a specified part of a strided list.
Returns a list that contains the elements of myList but with the strides in the range of start to end removed.
• list | src | |||
• integer | start | |||
• integer | end | |||
• integer | stride |
<lsl> list ListStridedRemove(list src, integer start, integer end, integer stride) {
// fixed and improved by Madpeter Zond (the wiki entry is trash please update it) if((start < 1)
Examples
<lsl>list customers = ListStridedRemove(customers, 0, 0, STRIDELENGTH);</lsl>