public
Description: WoW Addon - LDB FPS data feed
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/picofps.git
Click here to lend your support to: picofps and make a donation at www.pledgie.com !
Update LDB to v1.1.3
tekkub (author)
Mon Jul 07 18:46:35 -0700 2008
commit  a304e5f9f1204e2a03298c874cd65f5ee46ae9fd
tree    fb76cb18625250275c677a9f94964e5e05970e34
parent  bbe726e617e1e1c5ac609b0c408f7d169a621709
...
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
42
 
 
 
43
44
45
 
 
 
 
 
 
 
 
 
 
 
 
 
46
47
48
49
 
 
 
 
 
 
 
 
 
 
 
 
50
...
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
42
43
44
45
46
47
48
49
50
51
52
53
 
 
54
55
56
57
58
59
60
61
62
63
64
65
66
0
@@ -2,49 +2,65 @@
0
 assert(LibStub, "LibDataBroker-1.1 requires LibStub")
0
 assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
0
 
0
-local lib = LibStub:NewLibrary("LibDataBroker-1.1", 1)
0
+local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3)
0
 if not lib then return end
0
+oldminor = oldminor or 0
0
 
0
 
0
 lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
0
 lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {}
0
-local attributestorage, namestorage, proxystorage = lib.attributestorage, lib.namestorage, lib.proxystorage
0
+local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
0
 
0
-local domt = {
0
- __metatable = "access denied",
0
- __newindex = function(self, key, value)
0
+if oldminor < 2 then
0
+ lib.domt = {
0
+ __metatable = "access denied",
0
+ __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
0
+ }
0
+end
0
+
0
+if oldminor < 3 then
0
+ lib.domt.__newindex = function(self, key, value)
0
     if not attributestorage[self] then attributestorage[self] = {} end
0
     if attributestorage[self][key] == value then return end
0
     attributestorage[self][key] = value
0
     local name = namestorage[self]
0
     if not name then return end
0
- lib.callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value)
0
- lib.callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value)
0
- lib.callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value)
0
- lib.callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value)
0
- end,
0
- __index = function(self, key)
0
- return attributestorage[self] and attributestorage[self][key]
0
- end,
0
-}
0
-
0
-function lib:NewDataObject(name)
0
- if proxystorage[name] then return end
0
-
0
- local dataobj = setmetatable({}, domt)
0
- proxystorage[name], namestorage[dataobj] = dataobj, name
0
- lib.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
0
- return dataobj
0
+ callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
0
+ callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self)
0
+ callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self)
0
+ callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
0
+ end
0
 end
0
 
0
-function lib:DataObjectIterator()
0
- return pairs(proxystorage)
0
-end
0
+if oldminor < 2 then
0
+ function lib:NewDataObject(name, dataobj)
0
+ if self.proxystorage[name] then return end
0
 
0
-function lib:GetDataObjectByName(dataobjectname)
0
- return proxystorage[dataobjectname]
0
+ if dataobj then
0
+ assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
0
+ self.attributestorage[dataobj] = {}
0
+ for i,v in pairs(dataobj) do
0
+ self.attributestorage[dataobj][i] = v
0
+ dataobj[i] = nil
0
+ end
0
+ end
0
+ dataobj = setmetatable(dataobj or {}, self.domt)
0
+ self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
0
+ self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
0
+ return dataobj
0
+ end
0
 end
0
 
0
-function lib:GetNameByDataObject(dataobject)
0
- return namestorage[dataobject]
0
+if oldminor < 1 then
0
+ function lib:DataObjectIterator()
0
+ return pairs(self.proxystorage)
0
+ end
0
+
0
+ function lib:GetDataObjectByName(dataobjectname)
0
+ return self.proxystorage[dataobjectname]
0
+ end
0
+
0
+ function lib:GetNameByDataObject(dataobject)
0
+ return self.namestorage[dataobject]
0
+ end
0
 end

Comments

    No one has commented yet.