aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 697fdb4..9658376 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -43,6 +43,7 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
43using OpenSim.Region.ScriptEngine.Interfaces; 43using OpenSim.Region.ScriptEngine.Interfaces;
44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
45using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 45using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
46using System.Text.RegularExpressions;
46 47
47using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 48using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
48using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 49using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@@ -1105,5 +1106,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1105 loginURI = config.Configs["GridInfo"].GetString("login", loginURI); 1106 loginURI = config.Configs["GridInfo"].GetString("login", loginURI);
1106 return loginURI; 1107 return loginURI;
1107 } 1108 }
1109
1110 public LSL_String osFormatString(string str, LSL_List strings)
1111 {
1112 CheckThreatLevel(ThreatLevel.Low, "osFormatString");
1113 m_host.AddScriptLPS(1);
1114
1115 return String.Format(str, strings.Data);
1116 }
1117
1118 public LSL_List osMatchString(string src, string pattern, int start)
1119 {
1120 CheckThreatLevel(ThreatLevel.High, "osMatchString");
1121 m_host.AddScriptLPS(1);
1122
1123 LSL_List result = new LSL_List();
1124
1125 // Normalize indices (if negative).
1126 // After normlaization they may still be
1127 // negative, but that is now relative to
1128 // the start, rather than the end, of the
1129 // sequence.
1130 if (start < 0)
1131 {
1132 start = src.Length + start;
1133 }
1134
1135 if (start < 0 || start >= src.Length)
1136 {
1137 return result; // empty list
1138 }
1139
1140 // Find matches beginning at start position
1141 Regex matcher = new Regex(pattern);
1142 Match match = matcher.Match(src, start);
1143 if (match.Success)
1144 {
1145 foreach (System.Text.RegularExpressions.Group g in match.Groups)
1146 {
1147 if (g.Success)
1148 {
1149 result.Add(g.Value);
1150 result.Add(g.Index);
1151 }
1152 }
1153 }
1154
1155 return result;
1156 }
1108 } 1157 }
1109} 1158}