Quantcast

Merge pull request #28 from Nevcairiel/noleaks

Xruptor [11-29-15 - 14:35]
Merge pull request #28 from Nevcairiel/noleaks

Fix leaked global variables
Filename
BagSync.lua
BagSync_Search.lua
diff --git a/BagSync.lua b/BagSync.lua
index 7d27f97..143b4c6 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -331,7 +331,7 @@ local function ScanVoidBank()

 		for tab = 1, numTabs do
 			for i = 1, 80 do
-				itemID, textureName, locked, recentDeposit, isFiltered = GetVoidItemInfo(tab, i)
+				local itemID, textureName, locked, recentDeposit, isFiltered = GetVoidItemInfo(tab, i)
 				if (itemID) then
 					index = index + 1
 					slotItems[index] = itemID and tostring(itemID) or nil
@@ -846,7 +846,7 @@ local function AddItemToTooltip(frame, link) --workaround
 					end
 				end
 			end
-			_, link = GetItemInfo(newItemId) -- replace original link with our found link
+			link = select(2, GetItemInfo(newItemId)) -- replace original link with our found link
 		end
 	end

diff --git a/BagSync_Search.lua b/BagSync_Search.lua
index cc94e37..b98fb56 100644
--- a/BagSync_Search.lua
+++ b/BagSync_Search.lua
@@ -42,7 +42,7 @@ ItemSearch:RegisterTypedSearch{

 		for i = 1, tooltipScanner:NumLines() do
 			local text =  _G[tooltipScanner:GetName() .. 'TextLeft' .. i]:GetText():lower()
-			textChk = string.find(text, pattern)
+			local textChk = string.find(text, pattern)

 			if textChk and tostring(text):find(search) then
 				result = true