diff Modules/Scanner.lua @ 122:6724bc8eface

Reduced usage of global functions by defining them locally.
author Zerotorescue
date Sat, 15 Jan 2011 18:52:01 +0100
parents dc6f405c1a5d
children ee4672f21586
line wrap: on
line diff
--- a/Modules/Scanner.lua	Sat Jan 15 17:09:13 2011 +0100
+++ b/Modules/Scanner.lua	Sat Jan 15 18:52:01 2011 +0100
@@ -1,6 +1,10 @@
 local addon = select(2, ...);
 local mod = addon:NewModule("Scanner", "AceEvent-3.0", "AceTimer-3.0");
 
+local _G = _G;
+local select, pairs = _G.select, _G.pairs;
+local twipe, tinsert, mceil = _G.table.wipe, _G.table.insert, _G.math.ceil;
+
 local Mover, paused, currentLocation;
 local itemCache = {};
 
@@ -21,10 +25,10 @@
 local function GetSmallCoinTextureString(coins)
 	if coins >= 10000000 then
 		-- When we have1000g, hide silver and copper
-		coins = (math.ceil(coins / 10000) * 10000);
+		coins = (mceil(coins / 10000) * 10000);
 	elseif coins >= 10000 then
 		-- When we have 1g, hide copper
-		coins = (math.ceil(coins / 100) * 100);
+		coins = (mceil(coins / 100) * 100);
 	end
 	
 	return GetCoinTextureString(coins);
@@ -169,7 +173,7 @@
 end
 
 function mod:ClearCache()
-	table.wipe(itemCache);
+	twipe(itemCache);
 end
 
 function mod:CacheLocation(location, remember)
@@ -442,7 +446,7 @@
 			local data = {};
 			
 			for i, move in pairs(moves) do
-				table.insert(data, {
+				tinsert(data, {
 					["rowData"] = move, -- this is not a key usually found in a row item and ignored by the library
 					["cols"] = columns,
 				});