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