diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-04 03:32:03 -0500 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-04 03:32:03 -0500 |
commit | f19afefdda27a9661702d872c56b5d862e50452d (patch) | |
tree | 0a3b5a1ef87606d06d4aa0fffa03479a779729d8 | |
parent | d15047f9965803ba021eba226241c43d133930cb (diff) |
combine method added
-rw-r--r-- | misc/freeswitch/scripts/common/group.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/common/group.lua b/misc/freeswitch/scripts/common/group.lua index 5bd866e..ac2f542 100644 --- a/misc/freeswitch/scripts/common/group.lua +++ b/misc/freeswitch/scripts/common/group.lua @@ -109,3 +109,24 @@ function Group.permission_targets(self, group_ids, permission) return groups; end + + +function Group.combine(self, ...) + local groups = {}; + local group_sets = {...}; + for set_index=1, #group_sets do + if type(group_sets[set_index]) == 'table' then + local group_ids = group_sets[set_index]; + for index=1, #group_ids do + groups[tonumber(group_ids[index])] = true; + end + end + end + + local group_ids = {}; + for group_id, status in pairs(groups) do + table.insert(group_ids, group_id); + end + + return group_ids; +end |