Hi all
I am having an issue saving a table to a global table.
My add function requires a table and an itemlink, (for testing, I have the itemLink fixed as a number).
Here is my code and the button script;
Lua Code:
local tempSpellChatList = {}
local function addSpellToClassSpellList(addClassSpellList, addSpellLink)
print("test function incoming", addClassSpellList, spellLink) -- debug --
tempSpellChatList = {
addSpellLink = {
percentage = 100,
isEnabled = true,
spellChatList = {}
}
}
table.insert(addClassSpellList, 1, tempSpellChatList)
wipe(tempSpellChatList)
end
DeathKnightFrame.addItemButton:SetScript(
"OnClick",
function()
local itemLink = 123
print("test outgoing", DeathKnightSpellList, itemLink)
addSpellToClassSpellList(DeathKnightSpellList, itemLink)
updateDeathKnightSpellList()
end
)
The issue is that when I click the button the itemLink comes across as nil so the table is saved as an empty table.
The table comes across as the empty table is added so it is just the itemLink that is not coming across correctly.
My test prints confirm the itemlink is sent yet it does not seem to reach its destination.
I have stared at this code for ages without working out what I have messed up.
Hopefully, someone here can point out where I have screwed up.