Files
coa-elvui/ElvUI/Libraries/Ace3/LibStub/LibStub.lua
T
florian.berthold 0c130e013b chore(libs): sync Ace3 to coa-ace3 d422ad3
Aligns the unsuffixed Ace bundle with the rest of the Exiles forks
(the -ElvUI namespaced copies are intentionally left alone to keep
ElvUI's config UI isolated from any other addon's LibStub registrations).

Per-library MINOR moves:
  CallbackHandler-1.0   6  →  8
  AceAddon-3.0         12  → 13
  AceTimer-3.0       1017  → 17  (canonical numbering — same C_Timer impl)
  AceHook-3.0           8  →  9
  AceDB-3.0            27  → 33
  AceDBOptions-3.0     15  → 15  (unchanged)
  AceComm-3.0          12  → 14
  AceSerializer-3.0     3  →  5

Other Ace libs (Event, Config family, GUI, Locale, Console, Bucket) were
already at the canonical target.
2026-05-24 17:05:40 +02:00

31 lines
1.3 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)")
minor = assert(tonumber(string.match(minor, "%d+")), "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(("Cannot find a library instance of %q."):format(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