aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-13 16:16:08 +0000
committerMelanie Thielker2008-09-13 16:16:08 +0000
commitdccdeb57bbda32f00c10783a11f5746d460485af (patch)
treed7e5775b8aa1ee2d46444214401ca04a094fba32 /OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
parentProvide a GetApi method on the IScriptEngine to get a named API reference (diff)
downloadopensim-SC_OLD-dccdeb57bbda32f00c10783a11f5746d460485af.zip
opensim-SC_OLD-dccdeb57bbda32f00c10783a11f5746d460485af.tar.gz
opensim-SC_OLD-dccdeb57bbda32f00c10783a11f5746d460485af.tar.bz2
opensim-SC_OLD-dccdeb57bbda32f00c10783a11f5746d460485af.tar.xz
Fix some string to float casting nastiness. The "train script" now
works. Also makes llGetFreeMemory return the constant 16384. LLGetFreeMemory is useless in SL, as it never goes up, only down. So, the only thing it is used for, in practice, is to detect an imminent stack/heap collision, a danger we don't have.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 572debc..27af8a5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1689,7 +1689,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
1689 1689
1690 static public explicit operator LSLFloat(string s) 1690 static public explicit operator LSLFloat(string s)
1691 { 1691 {
1692 return new LSLFloat(double.Parse(s)); 1692 Regex r = new Regex("^[ ]*-?[0-9]*\\.?[0-9]*[eE]?-?[0-9]*");
1693 Match m = r.Match(s);
1694 string v = m.Groups[0].Value;
1695
1696 while (v.Length > 0 && v.Substring(0, 1) == " ")
1697 v = v.Substring(1);
1698
1699 if (v == String.Empty)
1700 v = "0";
1701
1702 return new LSLFloat(double.Parse(v));
1693 } 1703 }
1694 1704
1695 static public implicit operator LSLFloat(double d) 1705 static public implicit operator LSLFloat(double d)