-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv3Store.lua
More file actions
41 lines (34 loc) · 900 Bytes
/
Copy pathv3Store.lua
File metadata and controls
41 lines (34 loc) · 900 Bytes
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
33
34
35
36
37
38
39
40
41
-- RT v3 - Store.lua (racine)
RT.Store = RT.Store or {}
local _subs = {}
function RT.Store.Subscribe(topic, fn)
_subs[topic] = _subs[topic] or {}
table.insert(_subs[topic], fn)
end
function RT.Store.Notify(topic)
local list = _subs[topic]
if not list then return end
for i = 1, table.getn(list) do
local ok, err = pcall(list[i])
if not ok then RT.Print("|cffFF4444[store:" .. tostring(topic) .. "] " .. tostring(err) .. "|r") end
end
end
function RT.Store.DB()
RT_DB = RT_DB or {}
return RT_DB
end
function RT.Store.Roster()
local db = RT.Store.DB()
db.roster = db.roster or {}
return db.roster
end
function RT.Store.Loot()
local db = RT.Store.DB()
db.loot = db.loot or {}
return db.loot
end
function RT.Store.Attendance()
local db = RT.Store.DB()
db.attendance = db.attendance or {}
return db.attendance
end