Mercurial > wow > hotcorners
comparison Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua @ 20:9ad7f3c634f1 v8.0.1.020
- Updated Libraries.
| author | Tercio |
|---|---|
| date | Fri, 20 Jul 2018 19:13:08 -0300 |
| parents | fc346da3afd9 |
| children |
comparison
equal
deleted
inserted
replaced
| 19:817b319cd8ce | 20:9ad7f3c634f1 |
|---|---|
| 1 | 1 |
| 2 assert(LibStub, "LibDataBroker-1.1 requires LibStub") | 2 assert(LibStub, "LibDataBroker-1.1 requires LibStub") |
| 3 assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") | 3 assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") |
| 4 | 4 |
| 5 local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3) | 5 local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4) |
| 6 if not lib then return end | 6 if not lib then return end |
| 7 oldminor = oldminor or 0 | 7 oldminor = oldminor or 0 |
| 8 | 8 |
| 9 | 9 |
| 10 lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib) | 10 lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib) |
| 62 | 62 |
| 63 function lib:GetNameByDataObject(dataobject) | 63 function lib:GetNameByDataObject(dataobject) |
| 64 return self.namestorage[dataobject] | 64 return self.namestorage[dataobject] |
| 65 end | 65 end |
| 66 end | 66 end |
| 67 | |
| 68 if oldminor < 4 then | |
| 69 local next = pairs(attributestorage) | |
| 70 function lib:pairs(dataobject_or_name) | |
| 71 local t = type(dataobject_or_name) | |
| 72 assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)") | |
| 73 | |
| 74 local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name | |
| 75 assert(attributestorage[dataobj], "Data object not found") | |
| 76 | |
| 77 return next, attributestorage[dataobj], nil | |
| 78 end | |
| 79 | |
| 80 local ipairs_iter = ipairs(attributestorage) | |
| 81 function lib:ipairs(dataobject_or_name) | |
| 82 local t = type(dataobject_or_name) | |
| 83 assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)") | |
| 84 | |
| 85 local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name | |
| 86 assert(attributestorage[dataobj], "Data object not found") | |
| 87 | |
| 88 return ipairs_iter, attributestorage[dataobj], 0 | |
| 89 end | |
| 90 end |
