Quantcast

Give prop and ev both del functions.

Scott Sibley [08-09-10 - 05:56]
Give prop and ev both del functions.
Filename
LibEvaluator.lua
LibProperty.lua
diff --git a/LibEvaluator.lua b/LibEvaluator.lua
index 5fc7b23..8d2c496 100644
--- a/LibEvaluator.lua
+++ b/LibEvaluator.lua
@@ -3,19 +3,19 @@
 local MAJOR = "LibEvaluator-1.0"
 local MINOR = 1
 assert(LibStub, MAJOR.." requires LibStub")
-local Evaluator = LibStub:NewLibrary(MAJOR, MINOR)
-if not Evaluator then return end
+local LibEvaluator = LibStub:NewLibrary(MAJOR, MINOR)
+if not LibEvaluator then return end

-if not Evaluator.__index then
-	Evaluator.__index = Evaluator
-	Evaluator.pool = setmetatable({}, {__mode = "k"})
+if not LibEvaluator.__index then
+	LibEvaluator.__index = LibEvaluator
+	LibEvaluator.pool = setmetatable({}, {__mode = "k"})
 end

-Evaluator.__call = function(...)
+LibEvaluator.__call = function(...)
 	self.ExecuteCode(...)
 end

-function Evaluator:New()
+function LibEvaluator:New()

 	local obj = next(self.pool)

@@ -30,9 +30,13 @@ function Evaluator:New()
 	return obj
 end

+function LibEvaluator:Del(ev)
+	LibEvaluator.pool[ev] = true
+end
+
 do
 	local pool = setmetatable({},{__mode='v'})
-	Evaluator.ExecuteCode = function(self, tag, code, dontSandbox, defval)
+	LibEvaluator.ExecuteCode = function(self, tag, code, dontSandbox, defval)
 		if not defval and not dontDefault then defval = "" end

 		if not self or not tag or not code then return end
diff --git a/LibProperty.lua b/LibProperty.lua
index a52c950..8f06070 100644
--- a/LibProperty.lua
+++ b/LibProperty.lua
@@ -43,6 +43,10 @@ function LibProperty:New(v, line, name, defval)
 	return obj
 end

+function LibProperty:Del(prop)
+	LibProperty.pool[prop] = true
+end
+
 function LibProperty:Eval()
 	if not self.is_valid then return -1 end