Mercurial > wow > libmoduledbshare-1-0
comparison LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua @ 15:1dd07f05ecac
added param checks to LMDBS:NewGroup
| author | Andrew Knoll <andrewtknoll@gmail.com> |
|---|---|
| date | Sun, 10 Mar 2013 22:50:29 -0400 |
| parents | 5947b9721b9c |
| children | 2384f5c2a707 |
comparison
equal
deleted
inserted
replaced
| 13:92df9433aeb9 | 15:1dd07f05ecac |
|---|---|
| 7 -- @name LibModuleDBShare-1.0.lua | 7 -- @name LibModuleDBShare-1.0.lua |
| 8 local MAJOR, MINOR = "LibModuleDBShare-1.0", 1 | 8 local MAJOR, MINOR = "LibModuleDBShare-1.0", 1 |
| 9 local LibModuleDBShare, oldminor = LibStub:NewLibrary(MAJOR, MINOR) | 9 local LibModuleDBShare, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
| 10 | 10 |
| 11 if not LibModuleDBShare then return end -- No upgrade needed | 11 if not LibModuleDBShare then return end -- No upgrade needed |
| 12 | |
| 13 -- Lua APIs | |
| 14 local assert = assert; | |
| 12 | 15 |
| 13 local AceDB = LibStub("AceDB-3.0"); | 16 local AceDB = LibStub("AceDB-3.0"); |
| 14 | 17 |
| 15 LibModuleDBShare.groups = LibModuleDBShare.groups or {}; | 18 LibModuleDBShare.groups = LibModuleDBShare.groups or {}; |
| 16 | 19 |
| 22 -- @param initialProfile The name of the profile to start with. | 25 -- @param initialProfile The name of the profile to start with. |
| 23 -- @usage | 26 -- @usage |
| 24 -- local myAddonDBGroup = LibStub("LibModuleDBShare-1.0"):NewGroup("MyAddonGroupName", true) | 27 -- local myAddonDBGroup = LibStub("LibModuleDBShare-1.0"):NewGroup("MyAddonGroupName", true) |
| 25 -- @return the new DB group object | 28 -- @return the new DB group object |
| 26 function LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile) | 29 function LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile) |
| 27 -- param checks go here | 30 assert(type(groupName) == "string", "Usage: LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile): 'groupName' is not a string."); |
| 31 assert(type(LibModuleDBShare.groups[groupName]) == "nil", "LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile): 'groupName' already exists"); | |
| 28 local group = {} | 32 local group = {} |
| 29 group.name = groupName; | 33 group.name = groupName; |
| 30 group.syncDBTable = {}; | 34 group.syncDBTable = {}; |
| 31 group.syncDB = AceDB:New(group.syncDBTable, nil, true); | 35 group.syncDB = AceDB:New(group.syncDBTable, nil, true); |
| 32 for k, v in pairs(DBGroup) do | 36 for k, v in pairs(DBGroup) do |
