Hi actually
I have made some progress on this brick wall.
Now my toc looks like this;
Toc
Lua Code:
## Title: AAA |cffff0000 Testing Ground
## Interface: 80300
## Notes: |cffff0000 Testing Ground
## Version: AAA
## Date: Monday 3 August 2020
## SavedVariables: TableOfItems
AAA.lua
Lua
Lua Code:
local itemName, itemLink, itemID
if not TableOfItems then
TableOfItems = {}
end
local function addItemToTable(itemID)
print("add item function fired", itemID)
for k, v in pairs(TableOfItems) do
if v == itemID then
print("Item all ready listed")
else
table.insert(TableOfItems, 1, itemID)
print("Item added to list")
end
end
end
SLASH_MYTEST1 = "/qwe"
function SlashCmdList.MYTEST(msg, editbox)
print("slash command fired")
if #TableOfItems == 0 then
print("empty table")
else
for k, v in pairs(TableOfItems) do
print("item", k, v)
end
end
end
local btn = CreateFrame("BUTTON", "myTest")
SetBindingClick("F5", "myTest", "b1")
SetBindingClick("BUTTON2", "myTest", "b2")
SetBindingClick("G", "myTest", "b3")
btn:SetScript("OnClick", function(self, button)
GameTooltip:HookScript("OnTooltipSetItem", function(self)
itemName, itemLink = self:GetItem()
itemID = tonumber(strmatch(itemLink, "item:(%d+):"))
end)
if button == "b1" then
addItemToTable(itemID)
print("F5 button clicked", itemLink, itemID)
elseif button == "b2" then
print("mouse button 2 clicked")
elseif button == "b3" then
print("G button clicked")
end
end)
Now for some reason when I load in there are no errors showing on bugsack yet the button presses do nothing until I do a /reload.
Also adding the itemID to a table does not work; my prints show the slash command and add item functions are being fired yet no item is saved to the table.
I have probably made a noob mistake but I have not been able to nut this out.
Any further help would be great.