Or maybe it wasn't a type-o.
Does it still work if you do something like:
Lua Code:
return _lItemLink and GetMyLinkItemInfo(_lItemLink) or GetItemInfo(_iBagId, _iSlotId)
Sorry I should have just posted the actual code to begin with.
The idea is to call one function GetMyItemInfo(..) to get an items info whether you pass in a bag,slot or link:
Lua Code:
local function GetMyLinkItemInfo(_lItemLink)
local sIcon, iSellPrice, bMeetsUsageRequirement, iEquipType, iItemStyle = GetItemLinkInfo(_lItemLink)
local iItemQuality = GetItemLinkQuality(_lItemLink)
-- I know iStack & bLocked are not defined & return nil --
-- I'm ok with that, nothing wrong with doing that right ? --
return sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality
end
local function GetMyItemInfo(_iBagId, _iSlotId, _lItemLink)
-- These two below work
--return GetMyLinkItemInfo(_lItemLink)
--return GetItemInfo(_iBagId, _iSlotId)
-- But this one doesn't
return _lItemLink and GetMyLinkItemInfo(_lItemLink) or GetItemInfo(_iBagId, _iSlotId)
end
and then calling the following fails:
Lua Code:
-- Whether I call it with a bagId, slotId or Link they both fail at the same place --
local sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality = GetmyItemInfo(iBagId, iSlotId, nil)
local sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality = GetmyItemInfo(nil, nil, lLink)
d("sIcon: "..sIcon)
-- I know iStack can be nil if I pass in a link, thats ok --
if iStack then d("iStack: "..iStack) else d("iStack: Nil") end
--***************************************************--
-- iSellPrice: Fails with "Operator .. not supported for string .. nil" --
d("iSellPrice: "..iSellPrice)
--***************************************************--
d("bMeetsUsageRequirement: "..tostring(bMeetsUsageRequirement))
-- I know bLocked can be nil if I pass in a link, thats ok --
if bLocked then d("bLocked: "..tostring(bLocked)) else d("bLocked: Nil") end
d("iEquipType: "..iEquipType)
d("iItemStyle: "..iItemStyle)
d("iItemQuality: "..iItemQuality)