public LSL_Key llList2Key(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length || index < 0)
{
return "";
}
// SL spits out an empty string for types other than key & string
// At the time of patching, LSL_Key is currently LSL_String,
// so the OR check may be a little redundant, but it's being done
// for completion and should LSL_Key ever be implemented
// as it's own struct
// NOTE: 3rd case is needed because a NULL_KEY comes through as
// type 'obj' and wrongly returns ""
else if (!(src.Data[index] is LSL_String ||
src.Data[index] is LSL_Key ||
src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
{
return "";
}
return src.Data[index].ToString();
}