View Single Post
11-09-08, 11:27 PM   #15
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Okay... a follow up...

This did not work for me. Gave me a PocketPlotDB is nil error.
Code:
local PocketPlotDB = setmetatable(PocketPlotDB or {}, {__index = defaults})
Added
Code:
PocketPlotDB = PocketPlotDB or {}
in front of it and it worked for everything except the table of r,g,b,a values for my frame's background. Every other subtable (frame positions) worked... Then again, those subtables (frame positions) do not exist in the defaults table and are only added once the frame is actually moved.


This, modeled after what was shown in WoW Programming, gave me the same result as above. Worked for everything *except* the background color subtable.
Code:
PocketPlotDB = PocketPlotDB or {}
local ppdb = {}
setmetatable(PocketPlotDB, ppdb)
ppdb.__index = defaults

I finally went with conner686's method (since I do it at PLAYER_LOGIN anyhow) and it works perfectly.
Code:
for k,v in pairs(defaults) do
     if type(PocketPlotDB[k]) == "nil" then
          PocketPlotDB[k] = v
     end
end
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote