Fix string -> int cast to variable
parent
75380bc1aa
commit
084ea99be6
|
@ -1335,8 +1335,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public static explicit operator LSLInteger(LSLString s)
|
public static explicit operator LSLInteger(LSLString s)
|
||||||
{
|
{
|
||||||
// double.Parse() used because s could be "123.9" for example.
|
Regex r = new Regex("^[ ]*-?[0-9][0-9]*");
|
||||||
return new LSLInteger(double.Parse(s.m_string));
|
Match m = r.Match(s);
|
||||||
|
string v = m.Groups[0].Value;
|
||||||
|
|
||||||
|
if (v == String.Empty)
|
||||||
|
v = "0";
|
||||||
|
|
||||||
|
return new LSLInteger(int.Parse(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static explicit operator LSLString(double d)
|
public static explicit operator LSLString(double d)
|
||||||
|
@ -1467,7 +1473,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
if (v == String.Empty)
|
if (v == String.Empty)
|
||||||
v = "0";
|
v = "0";
|
||||||
|
|
||||||
// double.Parse() used because s could be "123.9" for example.
|
|
||||||
return new LSLInteger(int.Parse(v));
|
return new LSLInteger(int.Parse(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue