diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 96a7dae14e..c985d6f35d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs @@ -1244,9 +1244,9 @@ namespace OpenSim.Region.ScriptEngine.Common m_LSL_Functions.llEjectFromLand(pest); } - public void llParseString2List() + public LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers) { - m_LSL_Functions.llParseString2List(); + return m_LSL_Functions.llParseString2List(str,separators,spacers); } public int llOverMyLand(string id) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4054369a9d..8ef33d75f2 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2039,9 +2039,55 @@ namespace OpenSim.Region.ScriptEngine.Common NotImplemented("llEjectFromLand"); } - public void llParseString2List() + public LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers) { - NotImplemented("llParseString2List"); + LSL_Types.list ret = new LSL_Types.list(); + object[] delimeters = new object[separators.Length + spacers.Length]; + separators.Data.CopyTo(delimeters, 0); + spacers.Data.CopyTo(delimeters, separators.Length); + bool dfound = false; + do + { + dfound = false; + int cindex = -1; + string cdeli = ""; + for (int i = 0; i < delimeters.Length; i++) + { + int index = str.IndexOf(delimeters[i].ToString()); + bool found = index != -1; + if (found) + { + if ((cindex > index) || (cindex == -1)) + { + cindex = index; + cdeli = (string)delimeters[i]; + } + dfound = dfound || found; + } + } + if (cindex != -1) + { + if (cindex > 0) + { + ret.Add(str.Substring(0, cindex)); + if (spacers.Contains(cdeli)) + { + ret.Add(cdeli); + } + } + if (cindex == 0 && spacers.Contains(cdeli)) + { + ret.Add(cdeli); + } + str = str.Substring(cindex + 1); + } + } + while (dfound); + if (str != "") + { + ret.Add(str); + } + return ret; } public int llOverMyLand(string id) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index dbeeaf5063..f6ccca3219 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -409,7 +409,7 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: llEjectFromLand(key pest) void llEjectFromLand(string pest); - void llParseString2List(); + LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers); //wiki: integer llOverMyLand(key id) int llOverMyLand(string id); //wiki: key llGetLandOwnerAt(vector pos) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index e48f6673fd..bbdd4eefb5 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -354,6 +354,29 @@ namespace OpenSim.Region.ScriptEngine.Common return new list(tmp); } + public void Add(object o) + { + object[] tmp; + tmp = new object[m_data.Length + 1]; + m_data.CopyTo(tmp, 0); + tmp[m_data.Length] = o; + m_data = tmp; + } + + public bool Contains(object o) + { + bool ret = false; + foreach (object i in Data) + { + if (i == o) + { + ret = true; + break; + } + } + return ret; + } + public list GetSublist(int start, int end) { Console.WriteLine("GetSublist(" + start.ToString() + "," + end.ToString() + ")");