Your local variables are local to within that "if...end" statement. Once you pass that "end" your variables go out of scope. If you want them to be local to within the file, you need to declare them before the if statement:
Lua Code:
local equipmentMarkerControlName, replaceEnd
--Are we adding a tooltip to an equipment slot?
if pUpdateAllEquipmentTooltips then
--Get current controls name
equipmentMarkerControlName = markerControl:GetName()
--Get the offset for the ending digit(s)
replaceEnd = string.len(equipmentMarkerControlName) - locVars.gFCOMaxDigitsForIcons -- locVars.gFCOMaxDigitsForIcons = 1
--Remove the ending number
equipmentMarkerControlName = string.sub(equipmentMarkerControlName, 1, replaceEnd)
d("name: " .. equipmentMarkerControlName)
end
--Check if the item is marked with several icons
local markedIcons = {}
local bagId, slotIndex = MyGetItemDetails(markerControl:GetParent())
_, markedIcons = FCOIsMarked(GetItemInstanceId(bagId, slotIndex), -1)
for iconId, iconIsMarked in pairs(markedIcons) do
if iconIsMarked then
markedCounter = markedCounter + 1
if markedCounter > 1 then
--The variable will be NIL inside this FOR loop, but why?
if iconId ~= markerId and pUpdateAllEquipmentTooltips then
if equipmentMarkerControlName ~= "" then
d("bla: " .. tostring(equipmentMarkerControlName))
else
d("blubb")
end
end
end
end