Hi WOWInterface, I've come begging for help as this one is causing me quite the grief.
So I've got myself a table full of varibles (tblMySettings), the addon saves this table using #SavedVaribles: tblMySettings and seem's to load what is saved fine.
The downside is, while still writing this addon, adding variables to the table the obvious problem is it does not load the newly added variables unless i manually set the value myself. Also obviously if somebody else was using the addon and i gave it them as a update, they also would not receive the new varible values unless they deleted my addon's savedvaribles files from the WTF folder.
I did manage to stumble across this;
Code:
function CopyDefaults(src, dst)
if type(src) ~= "table" then return {} end
if type(dst) ~= "table" then dst = {} end
for k, v in pairs(src) do
if type(v) == "table" then
dst[k] = CopyDefaults(v, dst[k])
elseif type(v) ~= type(dst[k]) then
dst[k] = v
end
end
return dst
end
However truth be told I really am not sure how to correctly use it on ADDON_LOADED to load any varibles that was saved but also load what hasn't been saved.
A BIG thank you to whoever helps regarding this.