View Single Post
03-29-20, 11:39 PM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I'd suggest creating the LDB object in PLAYER_LOGIN because you only need to do that once. You could do in the main chunk of your addon code but that would force you to look up the object to see if it exists, and if so, get its value, and if not, create it. That's doing more CPU work than necessary. Anyway, here is the variant if you do not use PLAYER_LOGIN:
Code:
local dataobj = dataobj or ldb:NewDataObject("gmVideoSwitch", {
    -- blah
})
  Reply With Quote