From 3ebbb323a47e5a8c790e75f50eb20ada53260071 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 28 Nov 2018 12:56:41 -0600 Subject: [PATCH] fix #54 LunaUnitFrames --- !Compatibility/libs/LibStub.lua | 7 +++++-- ElvUI/Libraries/LibStub/LibStub.lua | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/!Compatibility/libs/LibStub.lua b/!Compatibility/libs/LibStub.lua index e45950e..0e99b45 100644 --- a/!Compatibility/libs/LibStub.lua +++ b/!Compatibility/libs/LibStub.lua @@ -5,6 +5,8 @@ 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] +local find, format = string.find, string.format + -- Check to see is this version of the stub is obsolete if not LibStub or LibStub.minor < LIBSTUB_MINOR then LibStub = LibStub or {libs = {}, minors = {} } @@ -19,7 +21,8 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then -- returns empty library object or old library object if upgrade is needed function LibStub:NewLibrary(major, minor) assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") - minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") + local _, _, num = 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 @@ -35,7 +38,7 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then -- returns the library object if found 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) + error(format("Cannot find a library instance of %q.", tostring(major)), 2) end return self.libs[major], self.minors[major] end diff --git a/ElvUI/Libraries/LibStub/LibStub.lua b/ElvUI/Libraries/LibStub/LibStub.lua index d89fe9f..0e99b45 100644 --- a/ElvUI/Libraries/LibStub/LibStub.lua +++ b/ElvUI/Libraries/LibStub/LibStub.lua @@ -1,8 +1,8 @@ -- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $ --- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info +-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/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_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! local LibStub = _G[LIBSTUB_MAJOR] local find, format = string.find, string.format @@ -51,4 +51,4 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then end setmetatable(LibStub, { __call = LibStub.GetLibrary }) -end +end \ No newline at end of file