Mercurial > wow > reaction
diff ReAction.lua @ 27:f1e838841ce1
Rearranged file tree, removed unused code for 1.x start-point
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 11 Mar 2008 21:39:34 +0000 |
parents | bf997ea151ca |
children | 21bcaf8215ff |
line wrap: on
line diff
--- a/ReAction.lua Fri Mar 07 22:20:30 2008 +0000 +++ b/ReAction.lua Tue Mar 11 21:39:34 2008 +0000 @@ -1,32 +1,32 @@ --[[ - ReAction Add-On main file. - Performs add-on and library initialization and setup. - --]] +------ LOCALIZATION ---------- +local L = AceLibrary("AceLocale-2.2"):new("ReAction") + +------ GLOBAL VARIABLES ------ -- 'ReAction' is exported as a global. ReAction = AceLibrary("AceAddon-2.0"):new( "AceModuleCore-2.0", "AceEvent-2.0", "AceDB-2.0" ) - -local ReAction = ReAction -local L = AceLibrary("AceLocale-2.2"):new("ReAction") -local AceOO = AceLibrary("AceOO-2.0") - - -ReAction.revision = tonumber(("$Revision: 1 $"):match("%d+")) -ReAction.L = L - -- global variable strings for integration with WoW keybindings dialog (see bindings.xml) BINDING_HEADER_REACTION = L["ReAction"] BINDING_NAME_REACTION_TOGGLELOCK = L["Toggle ReAction Bar Lock"] BINDING_NAME_REACTION_TOGGLEKEYBIND = L["ReAction Keybinding Mode"] + +------ CORE ------ +local ReAction = ReAction +ReAction.revision = tonumber(("$Revision: 1 $"):match("%d+")) +ReAction.L = L + + + -- from AceAddon-2.0 function ReAction:OnInitialize() self:RegisterDB("ReActionDB") @@ -100,65 +100,3 @@ ReAction.print = function() end end - --- utility -local newTable, recycle, deepCopy, deepDelete, varName -do - local pool = setmetatable( { }, {__mode="kv"} ) - - function newTable(...) - local t = table.remove(pool) or { } - for i = 1, select('#',...), 2 do - local k = select(i,...) - local v = select(i+1,...) - if k and v then - t[k] = v - end - end - return t - end - - function recycle(t) - if type(t) == "table" then - table.insert(pool,t) - end - end - - function deepCopy( x ) - if type(x) ~= "table" then - return x - end - local r = newTable() - for k,v in pairs(x) do - r[k] = deepCopy(v) - end - return r - end - - function deepDelete( x ) - if type(x) == "table" and x.IsObjectType == nil and not(AceOO.inherits(x,AceOO.Object)) then -- don't want to delete WoW or AceOO objects! - for k,v in pairs(x) do - x[k] = deepDelete(v) - end - recycle(x) - end - end - - function varName(s) - return tostring(s):gsub("[^a-zA-Z0-9_]","_") - end - - local u = setmetatable( { }, {__newindex = function(self,k,v) rawset(self,#self+1,v) ; rawset(self,k,v) end} ) - u.deepCopy = deepCopy - u.deepDelete = deepDelete - u.newTable = newTable - u.recycle = recycle - u.varName = varName - - ReAction.util = u -end - -function ReAction:GetUtilFuncs() - return unpack(self.util) -end -