blob: 5b43fd8823e646127de8741fb40d51a541ddb4cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
ch_core.open_submod("vgroups")
local vgroups = {}
local private_vgroups = {}
function ch_core.create_private_vgroup(vgroup, tbl)
if vgroups[vgroup] then
error("Vgroup "..vgroup.." demanded as private already exists!")
end
local result = tbl or {}
vgroups[vgroup] = result
private_vgroups[vgroup] = true
return result
end
function ch_core.get_shared_vgroup(vgroup)
if private_vgroups[vgroup] then
error("Vgroup "..vgroup.." is private!")
end
local result = vgroups[vgroup]
if not result then
result = {}
vgroups[vgroup] = result
end
return result
end
function ch_core.try_read_vgroup(vgroup)
return vgroups[vgroup]
end
ch_core.close_submod("vgroups")
|