From b05e63e6f9b61506f7e49f408ffa37d96ef05b35 Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Thu, 30 Oct 2008 03:43:39 +0800 Subject: [PATCH] Minor optimization by replacing custom clearTable() function with wipe() --- Omen.lua | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Omen.lua b/Omen.lua index 8f4cffb..196aaec 100644 --- a/Omen.lua +++ b/Omen.lua @@ -50,8 +50,7 @@ LSM:Register("sound", "Aoogah!", [[Interface\AddOns\Omen\aoogah.ogg]]) ----------------------------------------------------------------------------- -- Localize some global functions local floor, format = floor, format -local sort = sort -local tinsert, tremove = tinsert, tremove +local tinsert, tremove, sort, wipe = tinsert, tremove, sort, wipe local UnitDetailedThreatSituation = UnitDetailedThreatSituation local UnitExists, UnitGUID, UnitName, UnitClass = UnitExists, UnitGUID, UnitName, UnitClass local UnitIsPlayer, UnitPlayerControlled, UnitCanAttack = UnitIsPlayer, UnitPlayerControlled, UnitCanAttack @@ -229,18 +228,6 @@ local function delTable(t) return nil -- return nil to assign input reference end --- Empties a table of everything -- Non-recursive -local function clearTable(t) - if type(t) == "table" then - for k, v in pairs(t) do - t[k] = nil - end - t[true] = true - t[true] = nil - setmetatable(t, nil) - end -end - ----------------------------------------------------------------------------- -- Omen initialization and frame functions @@ -1395,7 +1382,7 @@ function Omen:UpdateBars() if lastWarn.mobGUID ~= mobGUID then delTable(threatStore) threatStore = newTable() - clearTable(threatStoreTime) + wipe(threatStoreTime) end tinsert(threatStore, threatTable) tinsert(threatStoreTime, GetTime()) @@ -1424,7 +1411,7 @@ function Omen:ClearAll() -- Remove TPS data delTable(threatStore) threatStore = newTable() - clearTable(threatStoreTime) + wipe(threatStoreTime) threatTable = nil end