Quantcast

Code cleanup.

F16Gaming (Laptop) [04-05-12 - 10:33]
Code cleanup.
Filename
Events.lua
String.lua
diff --git a/Events.lua b/Events.lua
index b01ac07..51e2ac0 100644
--- a/Events.lua
+++ b/Events.lua
@@ -37,7 +37,7 @@ function C.Events.ADDON_LOADED(self, ...)
 	local name = (select(1, ...))
 	if name:lower() ~= self.Name:lower() then return end
 	self:Init()
-	C.Frame:UnregisterEvent("ADDON_LOADED")
+	self.Frame:UnregisterEvent("ADDON_LOADED")
 end

 --- Event handler for LFG_UPDATE
diff --git a/String.lua b/String.lua
index eda3adf..a5374ca 100644
--- a/String.lua
+++ b/String.lua
@@ -49,7 +49,7 @@ end

 --- Check if a string ends with a specific string.
 -- @param s String to be checked.
--- @param target Stromg to search for at end of s.
+-- @param target String to search for at end of s.
 --
 function CES:EndsWith(s, target)
 	return target == '' or s:sub(-target:len()) == target
@@ -77,15 +77,15 @@ function CES:Split(s, d)
 		end
 	else
 		if not s:find(d) then return {s} end
-		local p = "(.-)" .. d .. "()"
-		local nb = 0
+		local pattern = "(.-)" .. d .. "()"
+		local num = 0
 		local lastPos
-		for part,pos in s:gmatch(p) do
-			nb = nb + 1
-			t[nb] = part
+		for part,pos in s:gmatch(pattern) do
+			num = num + 1
+			t[num] = part
 			lastPos = pos
 		end
-		t[nb + 1] = s:sub(lastPos)
+		t[num + 1] = s:sub(lastPos)
 	end
 	return t
 end