Quantcast
WoWInterface - View Single Post - Add table to list
View Single Post
02-21-21, 05:53 PM   #1
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 142
Add table to list

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:
  1. local tempSpellChatList = {}
  2.  
  3. local function addSpellToClassSpellList(addClassSpellList, addSpellLink)
  4.     print("test function incoming", addClassSpellList, spellLink) -- debug --
  5.     tempSpellChatList = {
  6.         addSpellLink = {
  7.             percentage = 100,
  8.             isEnabled = true,
  9.             spellChatList = {}
  10.         }
  11.     }
  12.     table.insert(addClassSpellList, 1, tempSpellChatList)
  13.     wipe(tempSpellChatList)
  14. end
  15.  
  16. DeathKnightFrame.addItemButton:SetScript(
  17.     "OnClick",
  18.     function()
  19.         local itemLink = 123
  20.         print("test outgoing", DeathKnightSpellList, itemLink)
  21.         addSpellToClassSpellList(DeathKnightSpellList, itemLink)
  22.         updateDeathKnightSpellList()
  23.     end
  24. )

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.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote