1 - Remove dependency to AceLibrary and use LibStub instead
Patch to remove dependency to AceLibrary and use LibStub instead.
Index: Libs/Deformat-2.0/Deformat-2.0.lua
===================================================================
--- Libs/Deformat-2.0/Deformat-2.0.lua (revision 49)
+++ Libs/Deformat-2.0/Deformat-2.0.lua (working copy)
@@ -11,14 +11,11 @@
]]
local MAJOR_VERSION = "Deformat-2.0"
-local MINOR_VERSION = 90000 + tonumber(("$Revision$"):match("(%d+)"))
+local MINOR_VERSION = tonumber(("$Revision$"):match("(%d+)"))
+local lib, oldMinor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
+if not lib then return end
-if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
-if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
-
-local Deformat = {}
-
do
local sequences = {
["%d*d"] = "%%-?%%d+",
@@ -199,7 +196,7 @@
end
end
- function Deformat:Deformat(text, a1, ...)
+ function lib:Deformat(text, a1, ...)
self:argCheck(text, 2, "string")
self:argCheck(a1, 3, "string")
local pattern = (''):join(a1, ...)
@@ -211,8 +208,5 @@
end
local mt = getmetatable(Deformat) or {}
-mt.__call = Deformat.Deformat
-setmetatable(Deformat, mt)
-
-AceLibrary:Register(Deformat, MAJOR_VERSION, MINOR_VERSION)
-Deformat = nil
+mt.__call = lib.Deformat
+setmetatable(lib, mt)
| User | When | Change |
|---|---|---|
| disht | Sun, 12 Oct 2008 23:51:13 | Create |
- 2 comments
- 2 comments
Facts
- Last updated on
- 15 Nov 2009
- Reported on
- 12 Oct 2008
- Status
- New - Issue has not had initial review yet.
- Type
- Patch - Source code patch for review
- Priority
- Medium - Normal priority.
- #2
Phanx Sun, 08 Mar 2009 06:30:16These lines:
self:argCheck(text, 2, "string") self:argCheck(a1, 3, "string")Need to be changed to:
assert(type(text) == "string", "Bad argument #2 to :Deformat (string expected)") assert(type(a1) == "string", "Bad argument #3 to :Deformat (string expected)")Since LibStub does not provide an "argCheck" function as AceLibrary does.
- #1
disht Sat, 08 Nov 2008 20:19:10Poke.