0
--- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
0
--- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
0
-local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
0
-local LibStub = _G[LIBSTUB_MAJOR]
0
-if not LibStub or LibStub.minor < LIBSTUB_MINOR then
0
- LibStub = LibStub or {libs = {}, minors = {} }
0
- _G[LIBSTUB_MAJOR] = LibStub
0
- LibStub.minor = LIBSTUB_MINOR
0
- function LibStub:NewLibrary(major, minor)
0
- assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
0
- minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
0
- local oldminor = self.minors[major]
0
- if oldminor and oldminor >= minor then return nil end
0
- self.minors[major], self.libs[major] = minor, self.libs[major] or {}
0
- return self.libs[major], oldminor
0
- function LibStub:GetLibrary(major, silent)
0
- if not self.libs[major] and not silent then
0
- error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
0
- return self.libs[major], self.minors[major]
0
- function LibStub:IterateLibraries() return pairs(self.libs) end
0
- setmetatable(LibStub, { __call = LibStub.GetLibrary })
0
+-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
0
+-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
0
+local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
0
+local LibStub = _G[LIBSTUB_MAJOR]
0
+if not LibStub or LibStub.minor < LIBSTUB_MINOR then
0
+ LibStub = LibStub or {libs = {}, minors = {} }
0
+ _G[LIBSTUB_MAJOR] = LibStub
0
+ LibStub.minor = LIBSTUB_MINOR
0
+ function LibStub:NewLibrary(major, minor)
0
+ assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
0
+ minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
0
+ local oldminor = self.minors[major]
0
+ if oldminor and oldminor >= minor then return nil end
0
+ self.minors[major], self.libs[major] = minor, self.libs[major] or {}
0
+ return self.libs[major], oldminor
0
+ function LibStub:GetLibrary(major, silent)
0
+ if not self.libs[major] and not silent then
0
+ error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
0
+ return self.libs[major], self.minors[major]
0
+ function LibStub:IterateLibraries() return pairs(self.libs) end
0
+ setmetatable(LibStub, { __call = LibStub.GetLibrary })
Comments
No one has commented yet.