I'm currently at a loss with this and have tried many different things to no avail, including searching google
To quickly explain what's going on, I'm trying to delete an item from a specific table in my addon's db - that uses AceDb - and it works, but the deletion is reverted when the game/ui is reloaded.
The table below is the table I've been working with to test. In my addon's config, I've coded the ability to remove spells from the group. In my case, I've been trying to remove item #3, "LavaBurst".
Lua Code:
groups = {
[1] = {
[1] = "FlameShock",
[2] = "EarthShock",
[3] = "LavaBurst",
[4] = "Earthquake",
[5] = "ElementalBlast",
},
...
},
The following methods were tried to delete the table item
Lua Code:
-- Tried the simplest way to remove a table item
tremove(db.auras[spec].groups[grp],j)
Lua Code:
-- Tried an advance means of removing a table item
local function RemoveItemFromTable(db,index)
local numItems = #db
db[index] = nil
if (index < numItems) then
for i=index,numItems do
if (db[i + 1]) then
db[i] = db[i + 1]
db[i + 1] = nil
else
db[numItems] = nil
end
end
end
end
Lua Code:
-- I even tried clearing that table completely and rebuilding it
local function RebuildAuraGroupTable(db,grp)
local tempTable = {}
for i=1,#db[grp] do
tinsert(tempTable,db[grp][i])
end
db[grp] = nil
db[grp] = {}
for i=1,#tempTable do
db[grp][i] = tempTable[i]
end
end
Using LuaBrowser, I can verify that "LavaBurst" is correctly removed from the table.
BEFORE DELETION
AFTER DELETION (Before game/UI reload)
AFTER DELETION (After game/UI reload)
It's clear that AceDb didn't recognize the deletion and is just loading slot #5 from the "defaults" table on reload. Is there any way to stop this from happening?