comparison Core.lua @ 5:2ce0f4db1a3e

Changelist trimming
author John@Yosemite-PC
date Mon, 05 Mar 2012 23:11:45 -0500
parents 431ddc8bdb4a
children 6d460ff2135c
comparison
equal deleted inserted replaced
4:6c8f9473b22e 5:2ce0f4db1a3e
18 -- important things to remember: 18 -- important things to remember:
19 -- 1) ipairs iterates from 1 until the first missing int index -> no gaps if int 19 -- 1) ipairs iterates from 1 until the first missing int index -> no gaps if int
20 -- indexing 20 -- indexing
21 -- 2) a.x === a["x"] 21 -- 2) a.x === a["x"]
22 -- 3) a["1"] =/= a[1] 22 -- 3) a["1"] =/= a[1]
23 -- 4) table.remove() works ok if reverse iterating, terrible at anything else
24 -- 5) pairs() does not have a guaranteed iteration order
23 25
24 bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0", "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0") 26 bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0", "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0")
25 local L = LibStub("AceLocale-3.0"):GetLocale("bsk", false) 27 local L = LibStub("AceLocale-3.0"):GetLocale("bsk", false)
26 28
27 local AceGUI = LibStub("AceGUI-3.0") 29 local AceGUI = LibStub("AceGUI-3.0")
36 38
37 self:RegisterChatCommand("bsk", "HandleCommand") 39 self:RegisterChatCommand("bsk", "HandleCommand")
38 end 40 end
39 41
40 function bsk:OnEnable() 42 function bsk:OnEnable()
41 bsk:CreateWorkingStateFromChanges() 43 bsk:CreateWorkingStateFromChanges(self.db.profile.changes)
42 --self:HandleCommand() 44 --self:HandleCommand()
43 end 45 end
44 46
45 function bsk:HandleCommand(paramIn) 47 function bsk:HandleCommand(paramIn)
46 local param = { strsplit(" ", paramIn) } 48 local param = { strsplit(" ", paramIn) }
98 if param[2] == nil or param[2] == "" then 100 if param[2] == nil or param[2] == "" then
99 bsk:PrintTable(param) 101 bsk:PrintTable(param)
100 return 102 return
101 end 103 end
102 bsk:PrintLists(param[2]) 104 bsk:PrintLists(param[2])
105 elseif param[1] == "trim" then
106 if param[2] == nil or param[2] == "" then
107 bsk:PrintTable(param)
108 return
109 end
110 bsk:TrimLists(param[2])
103 end 111 end
104 112
105 --if self.frame == nil then 113 --if self.frame == nil then
106 --self:CreateGUI() 114 --self:CreateGUI()
107 --self:ShowGUI() 115 --self:ShowGUI()