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.