Mercurial > wow > libmoduledbshare-1-0
changeset 15:1dd07f05ecac
added param checks to LMDBS:NewGroup
| author | Andrew Knoll <andrewtknoll@gmail.com> |
|---|---|
| date | Sun, 10 Mar 2013 22:50:29 -0400 |
| parents | 92df9433aeb9 |
| children | 2384f5c2a707 |
| files | LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua |
| diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua Sun Mar 10 03:38:18 2013 -0400 +++ b/LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua Sun Mar 10 22:50:29 2013 -0400 @@ -10,6 +10,9 @@ if not LibModuleDBShare then return end -- No upgrade needed +-- Lua APIs +local assert = assert; + local AceDB = LibStub("AceDB-3.0"); LibModuleDBShare.groups = LibModuleDBShare.groups or {}; @@ -24,7 +27,8 @@ -- local myAddonDBGroup = LibStub("LibModuleDBShare-1.0"):NewGroup("MyAddonGroupName", true) -- @return the new DB group object function LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile) - -- param checks go here + assert(type(groupName) == "string", "Usage: LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile): 'groupName' is not a string."); + assert(type(LibModuleDBShare.groups[groupName]) == "nil", "LibModuleDBShare:NewGroup(groupName, usesDualSpec, initialProfile): 'groupName' already exists"); local group = {} group.name = groupName; group.syncDBTable = {};
