comparison Libs/AceDB-3.0/AceDB-3.0.lua @ 5:c31ee4251181

Libs Update
author tercio
date Tue, 25 Nov 2014 21:15:10 -0200
parents fc346da3afd9
children 371e14cd2feb
comparison
equal deleted inserted replaced
4:453c68ff5d72 5:c31ee4251181
37 -- -- Assuming the .toc says ## SavedVariables: MyAddonDB 37 -- -- Assuming the .toc says ## SavedVariables: MyAddonDB
38 -- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true) 38 -- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
39 -- end 39 -- end
40 -- @class file 40 -- @class file
41 -- @name AceDB-3.0.lua 41 -- @name AceDB-3.0.lua
42 -- @release $Id: AceDB-3.0.lua 1096 2013-09-13 15:05:40Z nevcairiel $ 42 -- @release $Id: AceDB-3.0.lua 1124 2014-10-27 21:00:07Z funkydude $
43 local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 23 43 local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 26
44 local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR) 44 local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
45 45
46 if not AceDB then return end -- No upgrade needed 46 if not AceDB then return end -- No upgrade needed
47 47
48 -- Lua APIs 48 -- Lua APIs
258 local charKey = UnitName("player") .. " - " .. realmKey 258 local charKey = UnitName("player") .. " - " .. realmKey
259 local _, classKey = UnitClass("player") 259 local _, classKey = UnitClass("player")
260 local _, raceKey = UnitRace("player") 260 local _, raceKey = UnitRace("player")
261 local factionKey = UnitFactionGroup("player") 261 local factionKey = UnitFactionGroup("player")
262 local factionrealmKey = factionKey .. " - " .. realmKey 262 local factionrealmKey = factionKey .. " - " .. realmKey
263 local factionrealmregionKey = factionrealmKey .. " - " .. string.sub(GetCVar("realmList"), 1, 2):upper()
264 local localeKey = GetLocale():lower() 263 local localeKey = GetLocale():lower()
264
265 local regionTable = { "US", "KR", "EU", "TW", "CN" }
266 local regionKey = regionTable[GetCurrentRegion()]
267 local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
265 268
266 -- Actual database initialization function 269 -- Actual database initialization function
267 local function initdb(sv, defaults, defaultProfile, olddb, parent) 270 local function initdb(sv, defaults, defaultProfile, olddb, parent)
268 -- Generate the database keys for each section 271 -- Generate the database keys for each section
269 272
298 ["race"] = raceKey, 301 ["race"] = raceKey,
299 ["faction"] = factionKey, 302 ["faction"] = factionKey,
300 ["factionrealm"] = factionrealmKey, 303 ["factionrealm"] = factionrealmKey,
301 ["factionrealmregion"] = factionrealmregionKey, 304 ["factionrealmregion"] = factionrealmregionKey,
302 ["profile"] = profileKey, 305 ["profile"] = profileKey,
303 ["locale"] = localeKey, 306 ["locale"] = localeKey,
304 ["global"] = true, 307 ["global"] = true,
305 ["profiles"] = true, 308 ["profiles"] = true,
306 } 309 }
307 310
308 validateDefaults(defaults, keyTbl, 1) 311 validateDefaults(defaults, keyTbl, 1)