aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-09 01:01:45 +0000
committerMelanie Thielker2008-09-09 01:01:45 +0000
commit084ea99be62d63afc4d91f5f7b9118f39f02754c (patch)
tree78c210c3fcbe5a9c8095a227983d791d5348c0e0 /OpenSim/Region
parentFix delimiter access from list for llParseStringKeepNulls (diff)
downloadopensim-SC_OLD-084ea99be62d63afc4d91f5f7b9118f39f02754c.zip
opensim-SC_OLD-084ea99be62d63afc4d91f5f7b9118f39f02754c.tar.gz
opensim-SC_OLD-084ea99be62d63afc4d91f5f7b9118f39f02754c.tar.bz2
opensim-SC_OLD-084ea99be62d63afc4d91f5f7b9118f39f02754c.tar.xz
Fix string -> int cast to variable
Diffstat (limited to 'OpenSim/Region')
-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