mirror of
https://github.com/fuffc/WeakestAuras.git
synced 2026-11-17 08:24:36 +00:00
First public release WeakestAuras brings WeakAuras-style custom aura displays to the 1.12 client: icons, progress bars and groups, driven by triggers and conditions and configured entirely in-game. Requires the ClassicAPI, SuperWoW and Nampower client patches. The addon refuses to load without them rather than running degraded. Much of the engine is newly written and has had little time in front of a real client. Expect rough edges, and please report them.
39 lines
1.9 KiB
Lua
39 lines
1.9 KiB
Lua
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
|
|
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
|
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
|
local LibStub = _G[LIBSTUB_MAJOR]
|
|
|
|
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
|
LibStub = LibStub or {libs = {}, minors = {} }
|
|
_G[LIBSTUB_MAJOR] = LibStub
|
|
LibStub.minor = LIBSTUB_MINOR
|
|
|
|
function LibStub:NewLibrary(major, minor)
|
|
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
|
-- Upstream LibStub uses string.match here, which does not exist in this
|
|
-- client's Lua 5.0 -- every NewLibrary call would throw, taking down the
|
|
-- top-level chunk of whichever library file called it. It only ever
|
|
-- mattered latently: at equal LIBSTUB_MINOR the first copy to load
|
|
-- installs itself and every later one skips, and the other addons in this
|
|
-- folder that vendor LibStub all ship this same string.find patch, so
|
|
-- theirs has been winning. Load order is not something to depend on.
|
|
local _, _, num = string.find(minor, "(%d+)")
|
|
minor = assert(tonumber(num), "Minor version must either be a number or contain a number.")
|
|
|
|
local oldminor = self.minors[major]
|
|
if oldminor and oldminor >= minor then return nil end
|
|
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
|
|
return self.libs[major], oldminor
|
|
end
|
|
|
|
function LibStub:GetLibrary(major, silent)
|
|
if not self.libs[major] and not silent then
|
|
error(string.format(("Cannot find a library instance of %q."), tostring(major)), 2)
|
|
end
|
|
return self.libs[major], self.minors[major]
|
|
end
|
|
|
|
function LibStub:IterateLibraries() return pairs(self.libs) end
|
|
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
|
end
|