public LSL_Float llList2Float(LSL_List src, int index)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Float();
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length || index < 0)
{
return 0.0;
}
try
{
if (src.Data[index] is LSL_Integer)
return Convert.ToDouble(((LSL_Integer)src.Data[index]).value);
if (src.Data[index] is LSL_Float)
return Convert.ToDouble(((LSL_Float)src.Data[index]).value);
if (src.Data[index] is LSL_String)
return Convert.ToDouble(((LSL_String)src.Data[index]).m_string);
return Convert.ToDouble(src.Data[index]);
}
catch (FormatException)
{
return 0.0;
}
catch (InvalidCastException)
{
return 0.0;
}
}