diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9d610bbc93..a3fb5d637a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5753,100 +5753,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return result;
}
- /* old incompatible code
- ///
- /// 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 LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
- {
- LSL_List result = new();
- int[] si = new int[2];
- int[] ei = new int[2];
- bool twopass = false;
-
-
- // 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;
- }
- */
public LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 91caeb9447..b04ee074ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -6043,5 +6043,96 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject parcel = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
return parcel is null ? ScriptBaseClass.NULL_KEY : new LSL_Key(parcel.GlobalID.ToString());
}
+
+ // old List2ListStrided for compatibility
+ ///
+ /// Elements in the source list starting with 0 and then
+ /// every i+stride. If the stride is negative then the scan
+ /// Only those elements that are also in the specified
+ /// range are included in the result.
+ ///
+
+ public LSL_List osOldList2ListStrided(LSL_List src, int start, int end, int stride)
+ {
+ LSL_List result = new();
+ int[] si = new int[2];
+ int[] ei = new int[2];
+ bool twopass = false;
+
+ // First step is always to deal with negative indices
+
+ if (start < 0)
+ start += src.Length;
+ if (end < 0)
+ end += src.Length;
+
+ // 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;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 1b2adf6191..76edca2ca5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -602,5 +602,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_List osGetParcelDetails(LSL_Key id, LSL_List param);
LSL_List osGetParcelIDs();
LSL_Key osGetParcelID();
+ LSL_List osOldList2ListStrided(LSL_List src, int start, int end, int stride);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 705ebd3eae..09b34e87ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1658,5 +1658,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetParcelID();
}
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public LSL_List osOldList2ListStrided(LSL_List src, int start, int end, int stride)
+ {
+ return m_OSSL_Functions.osOldList2ListStrided(src, start, end, stride);
+ }
}
}