Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llList2ListStrided C# (CSharp) Метод

llList2ListStrided() публичный Метод

Elements in the source list starting with 0 and then every i+stride. If the stride is negative then the scan is backwards producing an inverted result. Only those elements that are also in the specified range are included in the result.
public llList2ListStrided ( Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list src, int start, int end, int stride ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
src Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
start int
end int
stride int
Результат Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
        public LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
        {

            LSL_List result = new LSL_List();
            int[] si = new int[2];
            int[] ei = new int[2];
            bool twopass = false;

            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_List();


            //  First step is always to deal with negative indices

            if (start < 0)
                start = src.Length + start;
            if (end < 0)
                end = src.Length + end;

            //  Out of bounds indices are OK, just trim them
            //  accordingly

            if (start > src.Length)
                start = src.Length;

            if (end > src.Length)
                end = src.Length;

            if (stride == 0)
                stride = 1;

            //  There may be one or two ranges to be considered

            if (start != end)
            {

                if (start <= end)
                {
                    si[0] = start;
                    ei[0] = end;
                }
                else
                {
                    si[1] = start;
                    ei[1] = src.Length;
                    si[0] = 0;
                    ei[0] = end;
                    twopass = true;
                }

                //  The scan always starts from the beginning of the
                //  source list, but members are only selected if they
                //  fall within the specified sub-range. The specified
                //  range values are inclusive.
                //  A negative stride reverses the direction of the
                //  scan producing an inverted list as a result.

                if (stride > 0)
                {
                    for (int i = 0; i < src.Length; i += stride)
                    {
                        if (i <= ei[0] && i >= si[0])
                            result.Add(src.Data[i]);
                        if (twopass && i >= si[1] && i <= ei[1])
                            result.Add(src.Data[i]);
                    }
                }
                else if (stride < 0)
                {
                    for (int i = src.Length - 1; i >= 0; i += stride)
                    {
                        if (i <= ei[0] && i >= si[0])
                            result.Add(src.Data[i]);
                        if (twopass && i >= si[1] && i <= ei[1])
                            result.Add(src.Data[i]);
                    }
                }
            }
            else
            {
                if (start % stride == 0)
                {
                    result.Add(src.Data[start]);
                }
            }

            return result;
        }
LSL_Api