View Single Post
11-05-08, 12:17 PM   #12
slizen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
Just checking your db table with:
Code:
MYMODDB = MYMODDB or defaults
is not enough.
The problem is it only checks if the table exists, not that all keys that are in the default table also exist in the MYMODB table.


So even if you add for example an alpha key to your defaults table, the table loaded from the saved variables where there is no alpha key will still be used.

Something like this should work:
Code:
for k,v in pairs(defaults) do
    if type(MYMODDB[k]) == "nil" then
        MYMODB[k] = v
    end
end
That or using a metatable as Slakah said.
  Reply With Quote