Lua Code:
local myTestingKeybindingItemName, myTestingKeybindingItemLink, myTestingKeybindingItemID
local function addItemToTable(itemLink)
if not myTestingKeybindingTableOfItems then
myTestingKeybindingTableOfItems = {}
end
local found
for k, v in pairs(myTestingKeybindingTableOfItems) do
if v == itemLink then
print("Item all ready listed")
found = true
break
end
end
if not found then
table.insert(myTestingKeybindingTableOfItems, 1, itemLink)
print("Item added to list",itemLink)
end
end
SLASH_MYTEST1 = "/qwe"
function SlashCmdList.MYTEST(msg, editbox)
if #myTestingKeybindingTableOfItems == 0 then
print("empty table")
else
for k, v in pairs(myTestingKeybindingTableOfItems) do
print("item", k, v)
end
end
end
local myTestingKeybindingButton = CreateFrame("BUTTON", "WalkerbomyTest")
SetBindingClick("F5", "WalkerbomyTest", "b1")
SetBindingClick("G", "WalkerbomyTest", "b3")
myTestingKeybindingButton:SetScript("OnClick", function(self, button)
if button == "b1" then
addItemToTable(myTestingKeybindingItemLink)
print("F5 button clicked", myTestingKeybindingItemLink, myTestingKeybindingItemID)
elseif button == "b3" then
print("G button clicked")
end
end)
GameTooltip:HookScript("OnTooltipSetItem", function(self)
myTestingKeybindingItemName, myTestingKeybindingItemLink = self:GetItem()
myTestingKeybindingItemID = tonumber(strmatch(myTestingKeybindingItemLink, "item:(%d+):"))
end)