Quantcast

Have new() give some feedback whether this is a freshly allocated table or not.

Scott Sibley [08-19-10 - 10:08]
Have new() give some feedback whether this is a freshly allocated table or not.
Filename
StarTip.lua
diff --git a/StarTip.lua b/StarTip.lua
index 06a758d..93c7bd9 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -180,17 +180,19 @@ do
 	local pool = setmetatable({},{__mode='k'})
 	function StarTip.new(...)
 		local t = next(pool)
+		local newtbl
 		if t then
 			pool[t] = nil
 			for i=1, select("#", ...) do
 				t[i] = select(i, ...)
 			end
 		else
+			newtbl = true
 			t = {...}
 		end
 		t.__starref__ = true

-		return t
+		return t, newtbl
 	end
 	function StarTip.del(...)
 		local t = select(1, ...)