I want to compare those too.. or well, i am looking for a method to compare an item with the equipped item in same slot. Is the easiest method simply to:
local EquipLoc = Select(9, GetItemInfo("item"))
if EquipLoc == "INVTYPE_BODY" then
SlotID = 5
elseif EquipLoc == "INVTYPE_HEAD" then
-- And so on...
There is GetInventorySlotInfo, but it won't help you much (at least you should use it instead of hard-coded IDs). InventorySlotName is different from ItemEquipLoc.
The main reason is that an item can fit multiple slots, e.g. a ring for both finger slots or a one-handed weapon for both hands.