Thank you for your help!!
It's working the way I want now.
Lua Code:
local function getGearItemLvl(slotName)
local lvl = 0
if (slotName ~= nil) then
local slotID, texture, checkRelic = GetInventorySlotInfo(slotName)
--print("getGearItemLvl " .. slotID .. " " .. texture .. " " .. tostring(checkRelic))
if (slotID ~= nil) then
local itemLocation = ItemLocation:CreateFromEquipmentSlot(slotID)
if C_Item.DoesItemExist(itemLocation) then
lvl = C_Item.GetCurrentItemLevel(itemLocation)
end
end
end
--print("getGearItemLvl("..slotName..") " .. " slotID: " .. slotID .. " itemlevel: " .. lvl)
return format("%s", lvl)
end
For anyone that needs this the slotName is one of "HeadSlot", "NeckSlot", "ShoulderSlot", "BackSlot"...