aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index f149f60..481f671 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1335,8 +1335,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
1335 1335
1336 public static explicit operator LSLInteger(LSLString s) 1336 public static explicit operator LSLInteger(LSLString s)
1337 { 1337 {
1338 // double.Parse() used because s could be "123.9" for example. 1338 Regex r = new Regex("^[ ]*-?[0-9][0-9]*");
1339 return new LSLInteger(double.Parse(s.m_string)); 1339 Match m = r.Match(s);
1340 string v = m.Groups[0].Value;
1341
1342 if (v == String.Empty)
1343 v = "0";
1344
1345 return new LSLInteger(int.Parse(v));
1340 } 1346 }
1341 1347
1342 public static explicit operator LSLString(double d) 1348 public static explicit operator LSLString(double d)
@@ -1467,7 +1473,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
1467 if (v == String.Empty) 1473 if (v == String.Empty)
1468 v = "0"; 1474 v = "0";
1469 1475
1470 // double.Parse() used because s could be "123.9" for example.
1471 return new LSLInteger(int.Parse(v)); 1476 return new LSLInteger(int.Parse(v));
1472 } 1477 }
1473 1478