public LSL_Integer llGetInventoryNumber(int type)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return 0;
int count = 0;
lock (m_host.TaskInventory)
{
#if (!ISWIN)
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == type || type == -1)
count++;
#else
count += m_host.TaskInventory.Values.Count(item => item.Type == type || type == -1);
#endif
}
return count;
}