Mercurial > wow > breuesk
changeset 42:72055fc7e115
A lot of work to reign in namespacing (inspiration: WIM)
author | John@Doomsday |
---|---|
date | Thu, 15 Mar 2012 08:47:41 -0400 |
parents | dc9bfacca238 |
children | 4109683c3172 |
files | Core.lua Gui.lua Lists.lua MultiSelectWidget.lua Namespace.lua Options.lua breuesk.toc |
diffstat | 6 files changed, 345 insertions(+), 617 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Wed Mar 14 22:06:19 2012 -0400 +++ b/Core.lua Thu Mar 15 08:47:41 2012 -0400 @@ -18,6 +18,15 @@ -- ( ) alt tracking -- (_) reserves +local _G=_G +local strsplit=strsplit +local string=string +local sformat=string.format +local bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0", "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0") +_G.bsk=bsk +local L = LibStub("AceLocale-3.0"):GetLocale("bsk", false) +setfenv(1,bsk) + local pkgrev = " @project-revision@ " -- important things to remember: @@ -28,27 +37,27 @@ -- 4) table.remove() works ok if reverse iterating, terrible at anything else -- 5) pairs() does not have a guaranteed iteration order -bsk = LibStub("AceAddon-3.0"):NewAddon("bsk","AceConsole-3.0", "AceHook-3.0", "AceComm-3.0", "AceSerializer-3.0") -local L = LibStub("AceLocale-3.0"):GetLocale("bsk", false) -function bsk:OnInitialize() +function OnInitialize() - self.db = LibStub("AceDB-3.0"):New("BskDB", self.defaults, "Default") + db = _G.LibStub("AceDB-3.0"):New("BskDB", defaults, "Default") + bsk:Print("Totally libstubbed a db") - self.options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) - LibStub("AceConfig-3.0"):RegisterOptionsTable("bsk", self.options) - self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("bsk", "bsk") + options.args.profile = _G.LibStub("AceDBOptions-3.0"):GetOptionsTable(db) + _G.LibStub("AceConfig-3.0"):RegisterOptionsTable("bsk", options) + --optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("bsk", "bsk") - self:RegisterChatCommand("bsk", "HandleCommand") + local HandlePassThrough = function(...) HandleCommand(...) end + bsk:RegisterChatCommand("bsk", HandlePassThrough) end -function bsk:OnEnable() - bsk:CreateWorkingStateFromChanges(self.db.profile.changes) - bsk:CreateGUI() +function OnEnable() + CreateWorkingStateFromChanges(db.profile.changes) + CreateGUI() end -function bsk:HandleCommand(paramIn) +function HandleCommand(paramIn) local param = { strsplit(" ", paramIn) } local FixPersonName = function(p) p = p:lower() @@ -62,129 +71,129 @@ return end if param[1] == "persons" then - bsk:PrintPersons() + PrintPersons() elseif param[1] == "changes" then - bsk:PrintChanges() + PrintChanges() elseif param[1] == "delete" then if param[2] == nil or param[2] == "" or param[3] == nil or param[3] == "" then - bsk:PrintTable(param) + PrintTable(param) return end if param[2] == "list" then - bsk:DeleteList(param[3]) + DeleteList(param[3]) elseif param[2] == "personfromlist" then if param[4] == nil or param[4] == "" then - bsk:PrintTable(param) + PrintTable(param) return end local person = FixPersonName(param[3]) - bsk:RemovePersonFromList(person, param[4]) + RemovePersonFromList(person, param[4]) elseif param[2] == "person" then local person = FixPersonName(param[3]) - bsk:RemovePerson(person) + RemovePerson(person) else bsk:Print(sformat("Deleting anything of type %s is not supported",param[2])) end elseif param[1] == "nuke" then if param[2] == nil or param[2] == "" then - bsk:PrintTable(param) + PrintTable(param) return end local person = FixPersonName(param[2]) - bsk:NukePerson(person) + NukePerson(person) elseif param[1] == "add" then if param[2] == nil or param[2] == "" then - bsk:PrintTable(param) + PrintTable(param) return end if param[3] == nil or param[3] == "" then - bsk:PrintTable(param) + PrintTable(param) return end if param[2] == "person" then if param[3] == "all" then - bsk:AddMissingPersons() + AddMissingPersons() else local person = FixPersonName(param[3]) - bsk:AddPerson(person) + AddPerson(person) end elseif param[2] == "list" then - bsk:CreateList(param[3]) + CreateList(param[3]) elseif param[2] == "tolist" then if param[4] == nil or param[4] == "" then - bsk:PrintTable(param) + PrintTable(param) return end local person = FixPersonName(param[3]) - bsk:AddPersonToListEnd(person,param[4]) + AddPersonToListEnd(person,param[4]) elseif param[2] == "tolistrandom" then if param[4] == nil or param[4] == "" then - bsk:PrintTable(param) + PrintTable(param) return end local person = FixPersonName(param[3]) - bsk:AddPersonToListRandom(person,param[4]) + AddPersonToListRandom(person,param[4]) end elseif param[1] == "populate" then if param[2] == nil or param[2] == "" or param[3] == nil or param[3] == "" then - bsk:PrintTable(param) + PrintTable(param) return end -- list = p2 - local index = bsk:GetListIndex(param[2]) + local index = GetListIndex(param[2]) if param[3] == "random" then - bsk:PopulateListRandom(index) + PopulateListRandom(index) end elseif param[1] == "suicide" then if param[2] == nil or param[2] == "" or param[3] == nil or param[3] == "" then - bsk:PrintTable(param) + PrintTable(param) return end local person = FixPersonName(param[2]) - bsk:SuicidePerson(person,param[3]) + SuicidePerson(person,param[3]) elseif param[1] == "lists" then if param[2] == nil or param[2] == "" then - bsk:PrettyPrintLists() + PrettyPrintLists() return else - local listIndex = bsk:GetListIndex(param[2]) - bsk:PrettyPrintList(listIndex) + local listIndex = GetListIndex(param[2]) + PrettyPrintList(listIndex) end elseif param[1] == "reserve" then if param[2] == nil or param[2] == "" then - bsk:printtable(param) + printtable(param) return end local person = FixPersonName(param[2]) - bsk:AddReserve(person) + AddReserve(person) elseif param[1] == "trim" then if param[2] == nil or param[2] == "" then - bsk:printtable(param) + printtable(param) return end - bsk:TrimLists(param[2]) + TrimLists(param[2]) elseif param[1] == "rename" then if param[2] == nil or param[2] == "" or param[3] == nil or param[3] == "" then - bsk:printtable(param) + printtable(param) return end - bsk:RenameList(param[2],param[3]) + RenameList(param[2],param[3]) elseif param[1] == "selfdestruct" then - bsk:SelfDestruct() + SelfDestruct() else - bsk:CreateGUI() + CreateGUI() end - --if self.frame == nil then - --self:CreateGUI() - --self:ShowGUI() + --if frame == nil then + --CreateGUI() + --ShowGUI() --else - --self:ShowGUI() + --ShowGUI() --end end -bsk.defaults = { +defaults = { profile = { persons = {}, changes = {},
--- a/Gui.lua Wed Mar 14 22:06:19 2012 -0400 +++ b/Gui.lua Thu Mar 15 08:47:41 2012 -0400 @@ -1,4 +1,14 @@ local AceGUI = LibStub("AceGUI-3.0") +local bsk=bsk +local _G=_G +local table=table +local pairs=pairs +local ipairs=ipairs +local string=string +local tostring=tostring +local type=type +local getn=getn +setfenv(1,bsk) local ChangeTab = function(container, event, group) container:ReleaseChildren() @@ -36,8 +46,8 @@ icon:SetWidth(sz,sz) icon:SetHeight(sz,sz) icon:SetImageSize(sz,sz) - icon:SetCallback("OnEnter", function(widget) GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); GameTooltip:Show() end ) - icon:SetCallback("OnLeave", function(widget) GameTooltip:Hide() end ) + icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end ) + icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end ) rightGroup:AddChild(icon) for i=1,12 do @@ -47,8 +57,8 @@ icon:SetWidth(sz,sz) icon:SetHeight(sz,sz) icon:SetImageSize(sz,sz) - icon:SetCallback("OnEnter", function(widget) GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); GameTooltip:Show() end ) - icon:SetCallback("OnLeave", function(widget) GameTooltip:Hide() end ) + icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end ) + icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end ) rightGroup:AddChild(icon) end @@ -68,7 +78,7 @@ end local pull = {} local ltemp = 0 - for i,v in pairs(bsk.lists) do + for i,v in pairs(lists) do pull[i] = v.name --local entry = {value=i,text=v.name} if ltemp == 0 and getn(v) > 0 then @@ -76,57 +86,57 @@ end end - bsk:PopulateRaidList() -- todo: this should be elsewhere + PopulateRaidList() -- todo: this should be elsewhere - bsk.scroller = AceGUI:Create("ScrollFrame") - bsk.scroller:SetLayout("List") - bsk.scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why - bsk.scroller:SetFullHeight(true) - bsk.scroller:SetFullWidth(true) + scroller = AceGUI:Create("ScrollFrame") + scroller:SetLayout("List") + scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why + scroller:SetFullHeight(true) + scroller:SetFullWidth(true) local label = AceGUI:Create("InteractiveLabel") label:SetText("fucking hell\n") - bsk.scroller:AddChild(label) - bsk.scroller:AddChild(rightGroup) + scroller:AddChild(label) + scroller:AddChild(rightGroup) - bsk.treecontrol = AceGUI:Create("TreeGroup") - bsk.treecontrol:EnableButtonTooltips(false) - bsk.treecontrol:SetFullWidth(true) - bsk.treecontrol:SetFullHeight(true) - bsk.treecontrol:SetAutoAdjustHeight(false) + treecontrol = AceGUI:Create("TreeGroup") + treecontrol:EnableButtonTooltips(false) + treecontrol:SetFullWidth(true) + treecontrol:SetFullHeight(true) + treecontrol:SetAutoAdjustHeight(false) - bsk.treecontrol:AddChild(bsk.scroller) + treecontrol:AddChild(scroller) local pulldown = AceGUI:Create("Dropdown") pulldown:SetWidth(175) pulldown:SetList(pull) - for i,v in pairs(bsk.lists) do + for i,v in pairs(lists) do if getn(v) == 0 then pulldown:SetItemDisabled(i,true) end end local ovc = function(_,_,value) - --bsk.treecontrol:ReleaseChildren() + --treecontrol:ReleaseChildren() local tree = {} - for x,y in ipairs(bsk.lists[value]) do - local p = bsk.persons[y.id] + for x,y in ipairs(lists[value]) do + local p = persons[y.id] local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} - line.iconCoords=CLASS_ICON_TCOORDS[p.class] - if not bsk.raidIdP[y.id] and not bsk.reserveIdP[y.id] then + line.iconCoords=_G.CLASS_ICON_TCOORDS[p.class] + if not raidIdP[y.id] and not reserveIdP[y.id] then line.disabled = true else - line.text=colorize(line.text,RAID_CLASS_COLORS[p.class]) + line.text=colorize(line.text,_G.RAID_CLASS_COLORS[p.class]) end table.insert(tree,line) end - bsk.treecontrol:SetTree(tree) + treecontrol:SetTree(tree) end pulldown:SetCallback("OnValueChanged", ovc) if ltemp > 0 then pulldown:SetValue(ltemp); ovc(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged container:AddChild(pulldown) - container:AddChild(bsk.treecontrol) + container:AddChild(treecontrol) --pulldown:EnableButtonTooltips(false) --pulldown:SetFullWidth(true) @@ -152,15 +162,15 @@ --GameTooltip:SetScript("OnTooltipSetSpell", myhook) --end -function bsk:CreateGUI() +function CreateGUI() -- Create a container frame - self.frame = AceGUI:Create("Frame") - self.frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) - self.frame:SetTitle("BSK") - self.frame:SetLayout("Flow") - self.frame:SetHeight(700) - self.frame:SetWidth(700) + frame = AceGUI:Create("Frame") + frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) + frame:SetTitle("BSK") + frame:SetLayout("Flow") + frame:SetHeight(700) + frame:SetWidth(700) --local opts = --{ @@ -200,16 +210,16 @@ --tab:SetCallback("OnGroupSelected",ChangeTab) --tab:SelectTab("tab1") - --self.frame:AddChild(tab) - ChangeTab(self.frame,0,"tab1") + --frame:AddChild(tab) + ChangeTab(frame,0,"tab1") -- Create a button --local btn = AceGUI:Create("Button") --btn:SetWidth(170) --btn:SetText("Button !") - --btn:SetCallback("OnClick", function() print("Click!") end) + --btn:SetCallback("OnClick", function() bsk:print("Click!") end) -- Add the button to the container - --self.frame:AddChild(btn) + --frame:AddChild(btn) end
--- a/Lists.lua Wed Mar 14 22:06:19 2012 -0400 +++ b/Lists.lua Thu Mar 15 08:47:41 2012 -0400 @@ -62,37 +62,54 @@ --}}} -- there are some dep chains here. for instance, to have a raidIdP value, a --- person must have a bsk.persons value which leads to a personName2id which +-- person must have a persons value which leads to a personName2id which -- leads to a raidIdP - -bsk.lists = {} -bsk.persons = {} - -bsk.raidNameP = {} -- "name" is present in raid -bsk.raidIdP = {} -- "id" is present in raid -bsk.reserveIdP = {} -- "reserve id present" -local personName2id = {} -- given "name" get that person's id - +local bsk = bsk +local _G=_G +local table=table +local string=string local tinsert = table.insert local sformat = string.format local getn = table.getn +local wipe = wipe +local pairs=pairs +local ipairs=ipairs +local tonumber=tonumber +local tostring=tostring +local time=time +local date=date +local math=math +local type=type +local assert=assert +local getmetatable=getmetatable +local setmetatable=setmetatable +setfenv(1,bsk) -function bsk:SelfDestruct() - bsk.lists = {} - bsk.persons = {} - bsk.db.profile.persons = {} - bsk.db.profile.changes = {} - bsk.db.profile.lists = {} - bsk.raidNameP = {} - bsk.raidIdP = {} - bsk.reserveIdP = {} +lists = {} +persons = {} + +raidNameP = {} -- "name" is present in raid +raidIdP = {} -- "id" is present in raid +reserveIdP = {} -- "reserve id present" +local personName2id = {} -- given "name" get that person's id + + +function SelfDestruct() + lists = {} + persons = {} + db.profile.persons = {} + db.profile.changes = {} + db.profile.lists = {} + raidNameP = {} + raidIdP = {} + reserveIdP = {} personName2id = {} end -function bsk:tcopy(to, from) +function tcopy(to, from) for k,v in pairs(from) do if(type(v)=="table") then to[k] = {} - bsk:tcopy(to[k], v); + tcopy(to[k], v); else to[k] = v; end @@ -105,110 +122,110 @@ end -- Debugging {{{ -function bsk:PrettyPrintList(listIndex) - local list = bsk.lists[listIndex] +function PrettyPrintList(listIndex) + local list = lists[listIndex] bsk:Print("List: " .. list.name .. " (" .. listIndex .. ") - last modified " .. date("%m/%d/%y %H:%M:%S", list.time) .. " (",list.time,")" ) for i = 1,#list do - bsk:Print(" " .. i .. " - " .. bsk.persons[list[i].id].main) + bsk:Print(" " .. i .. " - " .. persons[list[i].id].main) end end -function bsk:PrettyPrintLists() - for i,_ in pairs(bsk.lists) do - bsk:PrettyPrintList(i) +function PrettyPrintLists() + for i,_ in pairs(lists) do + PrettyPrintList(i) end end -function bsk:PrintLists() - bsk:PrintTable(bsk.lists) +function PrintLists() + PrintTable(lists) end -function bsk:PrintChanges() - bsk:PrintTable(bsk.db.profile.changes) +function PrintChanges() + PrintTable(db.profile.changes) end -function bsk:PrintPersons() - bsk:PrintTable(bsk.persons) +function PrintPersons() + PrintTable(persons) end -function bsk:PrintAPI(object) +function PrintAPI(object) for i,v in pairs(object) do if type(v) == "function" then bsk:Print("function "..i.."()") end end end -function bsk:PrintTable(table, depth) +function PrintTable(table, depth) depth = depth or "" if not table then return end - if #depth > 3*5 then self:Print(depth.."Recursion too deep - stopping"); return end + if #depth > 3*5 then bsk:Print(depth.."Recursion too deep - stopping"); return end for i,v in pairs(table) do if( type(v) == "string" ) then - self:Print(depth .. i .. " - " .. v) + bsk:Print(depth .. i .. " - " .. v) elseif( type(v) == "number" ) then - self:Print(depth .. i .. " - " .. tostring(v)) + bsk:Print(depth .. i .. " - " .. tostring(v)) elseif( type(v) == "table" ) then - self:Print(depth .. i .." - ") - self:PrintTable(v,depth.." ") + bsk:Print(depth .. i .." - ") + PrintTable(v,depth.." ") elseif( type(v) == "boolean" ) then - self:Print(depth .. i .. " - " .. tostring(v)) + bsk:Print(depth .. i .. " - " .. tostring(v)) elseif( type(v) == "function" ) then - self:Print(depth .. "function " .. i .. "()") + bsk:Print(depth .. "function " .. i .. "()") else - self:Print(depth .. i .. " - not sure how to print type: " .. type(v) ) + bsk:Print(depth .. i .. " - not sure how to print type: " .. type(v) ) end end end -function bsk:PrintRaidAndReserve() +function PrintRaidAndReserve() bsk:Print("RaidNameP") - bsk:PrintTable(bsk.raidNameP) + PrintTable(raidNameP) bsk:Print("RaidIdP") - bsk:PrintTable(bsk.raidIdP) + PrintTable(raidIdP) bsk:Print("ReserveP") - bsk:PrintTable(bsk.reserveIdP) + PrintTable(reserveIdP) bsk:Print("personName2id") - bsk:PrintTable(personName2id) + PrintTable(personName2id) end --}}} -function bsk:UpdatePersonsReverse() - for i,v in pairs(bsk.persons) do +function UpdatePersonsReverse() + for i,v in pairs(persons) do if i ~= "time" then personName2id[v.main] = i end end end --- Change processing {{{ -function bsk:CreateWorkingStateFromChanges(changes) - local personsBase = self.db.profile.persons - local lists = self.db.profile.lists +-- Czohange processing {{{ +function CreateWorkingStateFromChanges(changes) + local personsBase = db.profile.persons + local lists = db.profile.lists -- copy the base to the working state - wipe(bsk.lists) - wipe(bsk.persons) + wipe(lists) + wipe(persons) wipe(personName2id) - bsk:tcopy(bsk.lists,lists) - bsk:tcopy(bsk.persons,personsBase) + tcopy(lists,lists) + tcopy(persons,personsBase) -- now just go through the changes list applying each for i,v in ipairs(changes) do - bsk:ProcessChange(v) + ProcessChange(v) end -- update the persons reverse list - bsk:UpdatePersonsReverse() + UpdatePersonsReverse() end -function bsk:CreateChange(change) +function CreateChange(change) -- sanity assert(change) assert(change.action) assert(change.arg) - bsk:StartChange(change) - bsk:CommitChange(change) + StartChange(change) + CommitChange(change) end -function bsk:StartChange(change) - local changes = self.db.profile.changes +function StartChange(change) + local changes = db.profile.changes change.time = time() local n = getn(changes) if n > 0 then @@ -218,39 +235,40 @@ end end -function bsk:CommitChange(change) - local changes = self.db.profile.changes +function CommitChange(change) + local changes = db.profile.changes tinsert(changes,change) -- TODO: broadcast change end -function bsk:ProcessChange(change) +function ProcessChange(change) if change.action == "AddPerson" then - bsk:DoAddPerson(change) + DoAddPerson(change) elseif change.action == "RenameList" then - bsk:DoRenameList(change) + DoRenameList(change) elseif change.action == "CreateList" then - bsk:DoCreateList(change) + DoCreateList(change) elseif change.action == "DeleteList" then - bsk:DoDeleteList(change) + DoDeleteList(change) elseif change.action == "AddToListEnd" then - bsk:DoAddPersonToListEnd(change) + DoAddPersonToListEnd(change) elseif change.action == "AddToListRand" then - bsk:DoAddPersonToListRandom(change) + DoAddPersonToListRandom(change) elseif change.action == "RemovePerson" then - bsk:DoRemovePerson(change) + DoRemovePerson(change) elseif change.action == "RemovePersonFromList" then - bsk:DoRemovePersonFromList(change) + DoRemovePersonFromList(change) elseif change.action == "SuicidePerson" then - bsk:DoSuicidePerson(change) + DoSuicidePerson(change) else bsk:Print("Unknown message encountered") - bsk:PrintTable(change) + PrintTable(change) assert(false) end end --}}} +-- -- holy crap long winded {{{ -- timestamp logic: -- use time() for comparisons - local clients use date() to make it pretty. only @@ -286,12 +304,12 @@ -- Action Discussion {{{ -- The actual actions for changes start here -- --- Each action occurs as a pair of functions. The bsk:Action() function is from +-- Each action occurs as a pair of functions. The Action() function is from -- a list admin's point of view. Each will check for admin status, then create a -- change bundle, call the handler for that change (ie the DoAction func), and -- then record/transmist the bundle. These are simple and repetitive functions. -- --- The bsk:DoAction() function is tasked with executing the bundle and is what +-- The DoAction() function is tasked with executing the bundle and is what -- non-admins and admins alike will call to transform their working state via a -- change packet. Each Do() function will accept *only* a change packet, and -- it's assumed that the change has been vetted elsewhere. These are very blunt @@ -299,11 +317,11 @@ -- -- Note that "undo" has no special voodoo to it. It's basically a change that -- reverses the prior change on the stack.--}}} -function bsk:DoAddPerson(change)--{{{ +function DoAddPerson(change)--{{{ assert(change) assert(change.arg.id) -- require admin - local persons = bsk.persons + local persons = persons local name = change.arg.name local id = change.arg.id assert(persons[id]==nil) @@ -312,52 +330,52 @@ personName2id[name] = id return true end--}}} -function bsk:AddPerson(name)--{{{ - local persons = bsk.persons - local guid = UnitGUID(name) +function AddPerson(name)--{{{ + local persons = persons + local guid = _G.UnitGUID(name) -- TODO: check guid to be sure it's a player if not guid then - self:Print(sformat("Could not add player %s - they must be in range or group",name)) + bsk:Print(sformat("Could not add player %s - they must be in range or group",name)) return end - local _,englishClass = UnitClass(name) + local _,englishClass = _G.UnitClass(name) --bsk:Print("Person " .. name .. " is class " .. englishClass) local id = string.sub(guid,6) -- skip at least 0x0580 ... id = id:gsub("^0*(.*)","%1") -- nom all leading zeroes remaining if persons[id] and persons[id] ~= name then - self:Print(sformat("Namechange detected for %s - new is %s, please rename the existing entry", persons[id].main, name)) + bsk:Print(sformat("Namechange detected for %s - new is %s, please rename the existing entry", persons[id].main, name)) return end if persons[id] ~= nil then - self:Print(sformat("%s is already in the persons list; disregarding", name)) + bsk:Print(sformat("%s is already in the persons list; disregarding", name)) return end local change = {action="AddPerson",arg={name=name,id=id,class=englishClass}} - if bsk:DoAddPerson(change) then - bsk:CreateChange(change) + if DoAddPerson(change) then + CreateChange(change) end end--}}} -function bsk:DoCreateList(change)--{{{ - --if bsk:GetListIndex(change.arg.name) then - -- self:Print(sformat("List %s already exists",v.name)) +function DoCreateList(change)--{{{ + --if GetListIndex(change.arg.name) then + -- bsk:Print(sformat("List %s already exists",v.name)) -- return false --end - bsk.lists[change.arg.id]={name=change.arg.name,time=change.time} + lists[change.arg.id]={name=change.arg.name,time=change.time} return true end--}}} -function bsk:CreateList(name)--{{{ +function CreateList(name)--{{{ -- require admin local change={action="CreateList",arg={name=name}} - bsk:StartChange(change) + StartChange(change) change.arg.id=change.time -- use the creation timestamp as the list's index. it's as unique as anything... - self:Print("Creating ... " .. name) - if bsk:DoCreateList(change) then - bsk:CommitChange(change) + bsk:Print("Creating ... " .. name) + if DoCreateList(change) then + CommitChange(change) end end--}}} -function bsk:DoAddPersonToListEnd(change)--{{{ - local list = bsk.lists[change.arg.listIndex] +function DoAddPersonToListEnd(change)--{{{ + local list = lists[change.arg.listIndex] local index if getn(list) > 0 then index = list[#list].index + 0.1 @@ -372,23 +390,23 @@ return true end--}}} -function bsk:AddPersonToListEnd(name,listName)--{{{ +function AddPersonToListEnd(name,listName)--{{{ -- require admin - local listIndex = bsk:GetListIndex(listName) + local listIndex = GetListIndex(listName) local id = personName2id[name] - if bsk:IdIsInList(id,bsk.lists[listIndex]) then + if IdIsInList(id,lists[listIndex]) then bsk:Print(sformat("Person %s is already on the reqeuested list",name)) return false end bsk:Print(sformat("Adding %s (%s) to list %s (%s)", name, id, listName, listIndex)) local change = {action="AddToListEnd",arg={id=id,listIndex=listIndex}} - bsk:StartChange(change) - if bsk:DoAddPersonToListEnd(change) then - bsk:CommitChange(change) + StartChange(change) + if DoAddPersonToListEnd(change) then + CommitChange(change) end end--}}} -function bsk:DoAddPersonToListRandom(change)--{{{ - local list = bsk.lists[change.arg.listIndex] +function DoAddPersonToListRandom(change)--{{{ + local list = lists[change.arg.listIndex] local entry = {index=change.arg.roll, id=change.arg.id} tinsert(list,entry) @@ -397,34 +415,34 @@ return true end--}}} -function bsk:AddPersonToListRandom(name,listName)--{{{ +function AddPersonToListRandom(name,listName)--{{{ -- require admin - local listIndex = bsk:GetListIndex(listName) - if bsk.lists[listIndex].closedRandom then - self:Print("Cannot add person to list by random roll because an add-to-end operation has already occurred") + local listIndex = GetListIndex(listName) + if lists[listIndex].closedRandom then + bsk:Print("Cannot add person to list by random roll because an add-to-end operation has already occurred") return false end local id = personName2id[name] - if bsk:IdIsInList(id,bsk.lists[listIndex]) then + if IdIsInList(id,lists[listIndex]) then bsk:Print(sformat("Person %s is already on the reqeuested list",name)) return false end local roll = math.random() bsk:Print(sformat("Adding %s (%s) to list %s (%s) with roll (%f)", name, id, listName, listIndex, roll)) local change = {action="AddToListRand",arg={id=id,listIndex=listIndex,roll=roll}} - bsk:StartChange(change) - if bsk:DoAddPersonToListRandom(change) then - bsk:CommitChange(change) + StartChange(change) + if DoAddPersonToListRandom(change) then + CommitChange(change) end end--}}} -function bsk:DoRemovePerson(change)--{{{ - local person = bsk.persons[change.arg.id] +function DoRemovePerson(change)--{{{ + local person = persons[change.arg.id] personName2id[person.main] = nil - bsk.persons[change.arg.id] = nil - bsk.persons.time = change.time + persons[change.arg.id] = nil + persons.time = change.time return true end--}}} -function bsk:RemovePerson(name)--{{{ +function RemovePerson(name)--{{{ local id = personName2id[name] if not id then bsk:Print(sformat("%s is not in the persons list, please check your spelling", name)) @@ -432,24 +450,24 @@ end local listsTheyreOn = {} -- check if they're active on any loot list - for i,v in pairs(bsk.lists) do - if bsk:IdIsInList(id,v) then + for i,v in pairs(lists) do + if IdIsInList(id,v) then tinsert(listsTheyreOn,v.name) break end end if getn(listsTheyreOn) > 0 then - self:Print(sformat("Cannot remove person %s because they are on one or more lists (%s)",name,table.concat(listsTheyreOn,", "))) + bsk:Print(sformat("Cannot remove person %s because they are on one or more lists (%s)",name,table.concat(listsTheyreOn,", "))) return false end local change = {action="RemovePerson",arg={id=id}} - bsk:StartChange(change) - if bsk:DoRemovePerson(change) then - bsk:CommitChange(change) + StartChange(change) + if DoRemovePerson(change) then + CommitChange(change) end end--}}} -function bsk:DoSuicidePerson(change)--{{{ - local list = bsk.lists[change.arg.listIndex] +function DoSuicidePerson(change)--{{{ + local list = lists[change.arg.listIndex] local affected = shallowCopy(change.arg.affect) -- the goal here is to rotate the suicide list by 1 -- then we can just mash it on top of the intersection between the original @@ -459,7 +477,7 @@ local temp = table.remove(replacement,1) -- pop tinsert(replacement,temp) -- push_back --bsk:Print(sformat("Before suicide of %s on list %s",slist[1],list.name)) - --bsk:PrintTable(list) + --PrintTable(list) for i = 1, #list do if list[i].id == affected[1] then table.remove(affected,1) @@ -470,46 +488,46 @@ list.time=change.time return true end--}}} -function bsk:SuicidePerson(name,listName)--{{{ +function SuicidePerson(name,listName)--{{{ -- require admin - bsk:PopulateRaidList() - local listIndex = bsk:GetListIndex(listName) + PopulateRaidList() + local listIndex = GetListIndex(listName) local id = personName2id[name] - local affect=bsk:GetSuicideList(id,bsk.lists[listIndex]) + local affect=GetSuicideList(id,lists[listIndex]) local change = {action="SuicidePerson",arg={affect=affect,listIndex=listIndex}} - bsk:StartChange(change) - if bsk:DoSuicidePerson(change) then - bsk:CommitChange(change) + StartChange(change) + if DoSuicidePerson(change) then + CommitChange(change) end end--}}} -function bsk:DoRenameList(change)--{{{ - bsk.lists[change.arg.listIndex].name = change.arg.name - bsk.lists[change.arg.listIndex].time = change.time +function DoRenameList(change)--{{{ + lists[change.arg.listIndex].name = change.arg.name + lists[change.arg.listIndex].time = change.time return true end--}}} -function bsk:RenameList(listName,newListName)--{{{ +function RenameList(listName,newListName)--{{{ -- require admin - local listIndex = bsk:GetListIndex(listName) + local listIndex = GetListIndex(listName) local change = {action="RenameList",arg={listIndex=listIndex,name=newListName}} - bsk:StartChange(change) - if bsk:DoRenameList(change) then - bsk:CommitChange(change) + StartChange(change) + if DoRenameList(change) then + CommitChange(change) end end--}}} -function bsk:DoDeleteList(change)--{{{ - bsk.lists[change.arg.listIndex] = nil +function DoDeleteList(change)--{{{ + lists[change.arg.listIndex] = nil return true end--}}} -function bsk:DeleteList(listName)--{{{ - local listIndex = bsk:GetListIndex(listName) +function DeleteList(listName)--{{{ + local listIndex = GetListIndex(listName) local change = {action="DeleteList",arg={listIndex=listIndex}} - bsk:StartChange(change) - if bsk:DoDeleteList(change) then - bsk:CommitChange(change) + StartChange(change) + if DoDeleteList(change) then + CommitChange(change) end end--}}} -function bsk:DoRemovePersonFromList(change)--{{{ - local list = bsk.lists[change.arg.listIndex] +function DoRemovePersonFromList(change)--{{{ + local list = lists[change.arg.listIndex] for i,v in ipairs(list) do if v.id == change.arg.id then @@ -521,23 +539,23 @@ list.time = change.time return true end--}}} -function bsk:RemovePersonFromList(name,listName)--{{{ - local listIndex = bsk:GetListIndex(listName) +function RemovePersonFromList(name,listName)--{{{ + local listIndex = GetListIndex(listName) local pid = personName2id[name] -- todo: check that they're on the list in the first place local change = {action="RemovePersonFromList",arg={id=pid,listIndex=listIndex}} - bsk:StartChange(change) - if bsk:DoRemovePersonFromList(change) then - bsk:CommitChange(change) + StartChange(change) + if DoRemovePersonFromList(change) then + CommitChange(change) end end --}}} --}}} -- Higher order actions (ie calls other standard actions){{{ -function bsk:TrimLists(time) - if not bsk:CheckListCausality() then - self:Print("Unable to trim changelist due to violated causality") +function TrimLists(time) + if not CheckListCausality() then + bsk:Print("Unable to trim changelist due to violated causality") return false end @@ -547,7 +565,7 @@ -- bisect the changes list by "time" local before = {} - for i,v in ipairs(self.db.profile.changes) do + for i,v in ipairs(db.profile.changes) do if v.time <= time then tinsert(before,v) else @@ -556,44 +574,44 @@ end -- apply first half - bsk:CreateWorkingStateFromChanges(before) + CreateWorkingStateFromChanges(before) -- save this state permanently; trim the changes permanently - bsk:tcopy(bsk.db.profile.persons,bsk.persons) - bsk:tcopy(bsk.db.profile.lists,bsk.lists) - while bsk.db.profile.changes ~= nil and bsk.db.profile.changes[1] ~= nil and bsk.db.profile.changes[1].time <= time do - table.remove(bsk.db.profile.changes,1) + tcopy(db.profile.persons,persons) + tcopy(db.profile.lists,lists) + while db.profile.changes ~= nil and db.profile.changes[1] ~= nil and db.profile.changes[1].time <= time do + table.remove(db.profile.changes,1) end -- using the trimmed list and the new bases, recreate the working state - bsk:CreateWorkingStateFromChanges(bsk.db.profile.changes) + CreateWorkingStateFromChanges(db.profile.changes) end -function bsk:AddMissingPersons() - bsk:PopulateRaidList() +function AddMissingPersons() + PopulateRaidList() local t = {} - for id,_ in pairs(bsk.persons) do + for id,_ in pairs(persons) do t[id] = true end - for name,_ in pairs(bsk.raidNameP) do + for name,_ in pairs(raidNameP) do if personName2id[name] == nil then bsk:Print(sformat("Person %s is missing from the persons list - adding",name)) - bsk:AddPerson(name) + AddPerson(name) end end -- TODO: batch into a single op - no need to spam 25 messages in a row end -function bsk:PopulateListRandom(listIndex) +function PopulateListRandom(listIndex) -- difference (raid+reserve)-list, then random shuffle that, then add - bsk:PopulateRaidList() - local list = bsk.lists[listIndex] + PopulateRaidList() + local list = lists[listIndex] local t = {} -- after loops, contains intersection of IDs present between raid and reserve - for i,v in pairs(bsk.raidIdP) do + for i,v in pairs(raidIdP) do if v then t[i] = true end end - for i,v in pairs(bsk.reserveIdP) do + for i,v in pairs(reserveIdP) do if v then t[i] = true end end @@ -609,35 +627,36 @@ -- add all remaining for i,v in pairs(t) do if v then - bsk:AddPersonToListRandom(bsk.persons[i].main,list.name) -- TODO: APTLR keys off of string names. probably need to change this. + AddPersonToListRandom(persons[i].main,list.name) -- TODO: APTLR keys off of string names. probably need to change this. end end end -function bsk:NukePerson(name) -- delete from all lists and then from persons +function NukePerson(name) -- delete from all lists and then from persons local pid = personName2id[name] - for i,v in pairs(bsk.lists) do - bsk:RemovePersonFromList(name,v.name) + for i,v in pairs(lists) do + RemovePersonFromList(name,v.name) end - bsk:RemovePerson(name) + RemovePerson(name) end --}}} -- "Soft" actions- ie things that cause nonpermanent state {{{ -- reserves -function bsk:AddReserve(name) - bsk.reserveIdP[personName2id[name]]=true +function AddReserve(name) + bsk:Print("Reserving" .. name) + reserveIdP[personName2id[name]]=true -- TODO: communicate to others. don't store this in any way. end -function bsk:RemoveReserve(name) - bsk.reserveIdP[personName2id[name]]=false +function RemoveReserve(name) + reserveIdP[personName2id[name]]=false -- TODO: communicate to others. don't store this in any way. end ---function bsk:GetActiveList() --- return bsk.lists[1] -- todo! +--function GetActiveList() +-- return lists[1] -- todo! --end --}}} @@ -647,24 +666,24 @@ local pID = {} local rID = {} for i = 1, 4 do - pID[i] = format("party%d", i) + pID[i] = sformat("party%d", i) end for i = 1, 40 do - rID[i] = format("raid%d", i) + rID[i] = sformat("raid%d", i) end -function bsk:PopulateRaidList() - local inParty = GetNumPartyMembers() - local inRaid = GetNumRaidMembers() +function PopulateRaidList() + local inParty = _G.GetNumPartyMembers() + local inRaid = _G.GetNumRaidMembers() local add = function(unitNameArg) - local name = UnitName(unitNameArg) - bsk.raidNameP[name]=true + local name = _G.UnitName(unitNameArg) + raidNameP[name]=true if personName2id[name] ~= nil then - bsk.raidIdP[personName2id[name]]=true + raidIdP[personName2id[name]]=true end end - wipe(bsk.raidNameP) - wipe(bsk.raidIdP) + wipe(raidNameP) + wipe(raidIdP) if inRaid > 0 then for i = 1, inRaid do add(rID[i]) @@ -679,7 +698,7 @@ -- You're alone add("player") end - --bsk:PrintTable(bsk.raidNameP) + --PrintTable(raidNameP) end -- undo rules! @@ -691,9 +710,9 @@ -- prevent proper undo, such as add/delete player or add/delete list -function bsk:GetSuicideList(id,list) - --self:Print("Calculating changeset for "..name.." from list -") - --self:PrintTable(list) +function GetSuicideList(id,list) + --bsk:Print("Calculating changeset for "..name.." from list -") + --PrintTable(list) local t = {} local ret = {} local pushing = false @@ -701,17 +720,17 @@ if list[i].id == id then pushing = true end - if pushing and (bsk.raidIdP[list[i].id] or bsk.reserveIdP[list[i].id]) then + if pushing and (raidIdP[list[i].id] or reserveIdP[list[i].id]) then tinsert(ret,list[i].id) end end --bsk:Print("GSL") - --bsk:PrintTable(ret) + --PrintTable(ret) --bsk:Print("GSL") return ret end -function bsk:IdIsInList(id,listRef) +function IdIsInList(id,listRef) for i = 1,#listRef do if id == listRef[i].id then return true @@ -721,9 +740,9 @@ end -- returns true if the events in the list are in time order -function bsk:CheckListCausality() +function CheckListCausality() local t = nil - for i,v in ipairs(bsk.db.profile.changes) do + for i,v in ipairs(db.profile.changes) do if t ~= nil then if v.time <= t then return false @@ -736,8 +755,8 @@ -- Support functions -function bsk:GetListIndex(name) - for i,v in pairs(bsk.lists) do +function GetListIndex(name) + for i,v in pairs(lists) do if v.name == name then return i end @@ -745,12 +764,4 @@ return nil end -local shuffleArray = function(array) - local arrayCount = #array - for i = arrayCount, 2, -1 do - local j = math.random(1, i) - array[i], array[j] = array[j], array[i] - end - return array -end
--- a/MultiSelectWidget.lua Wed Mar 14 22:06:19 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,316 +0,0 @@ - - ---[[---------------------------------- --- MultiSelect widget for AceGUI-3.0 --- Written by Shirokuma ---]]---------------------------------- - - ---[[----------------- --- AceGUI ---]]----------------- -local AceGUI = LibStub("AceGUI-3.0") - ---[[----------------- --- Lua APIs ---]]----------------- -local format, pairs, tostring = string.format, pairs, tostring - ---[[----------------- --- WoW APIs ---]]----------------- -local CreateFrame, UIParent = CreateFrame, UIParent - ---[[----------------- --- Frame Elements ---]]----------------- -local FrameBackdrop = { - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 3, right = 3, top = 3, bottom = 3 } -} - - ---[[----------------- --- Widget Info ---]]----------------- -local widgetType = "MultiSelect" -local widgetVersion = 1 - - ---[[----------------- --- Event Code ---]]----------------- -local function Label_OnEnter(label) - local self = label.obj - local value = label - self:Fire("OnLabelEnter", value) -end - -local function Label_OnLeave(label) - local self = label.obj - local value = label - self:Fire("OnLabelEnter", value) -end - -local function Label_OnClick(label) - local self = label.obj - local value = label - self:Fire("OnLabelClick", value) - AceGUI:ClearFocus() -end - - ---[[----------------- --- MultiSelect Code ---]]----------------- -do - local function OnAcquire(self) -- set up the default size - self:SetWidth(200) - self:SetHeight(400) - end - - local function SetWidth(self, w) -- override the SetWidth function to include the labelframe - self.frame:SetWidth(w) - self.labelframe:SetWidth(w-33) - end - - local function SetLabel(self, text) -- sets the multiselect label text - self.label:SetText(text) - end - - local function SetMultiSelect(self, value) -- set if multiple values can be selected simultaneously - self.multiselect = value - end - - local function AddItem(self, str, color) -- add an item (create a new item label object) - local color = color - local label = CreateFrame("Button", nil, self.labelframe) - label.selected = false - label.obj = self - label:SetHeight(18) - label:SetPoint("TOPLEFT", self.labelframe, "TOPLEFT", 0, -(getn(self.labels) * 18)) - label:SetPoint("TOPRIGHT", self.labelframe, "TOPRIGHT", 0, -(getn(self.labels) * 18)) - self.labels[getn(self.labels) + 1] = label - self.labelframe:SetHeight(getn(self.labels) * 18) - - local text = label:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") - text:SetJustifyH("LEFT") - text:SetPoint("TOPLEFT",label,"TOPLEFT",5,0) - text:SetPoint("BOTTOMRIGHT",label,"BOTTOMRIGHT",-5,0) - if color ~= nil then - text:SetTextColor(color.r,color.g,color.b) - end - text:SetText(str) - label.text = text - - local highlight = label:CreateTexture(nil, "OVERLAY") - highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") - highlight:SetBlendMode("ADD") - highlight:SetHeight(14) - highlight:ClearAllPoints() - highlight:SetPoint("RIGHT",label,"RIGHT",0,0) - highlight:SetPoint("LEFT",label,"LEFT",0,0) - highlight:Hide() - label.highlight = highlight - - label:SetScript("OnEnter", function(this) - this.highlight:Show() - Label_OnEnter(this) - end) - label:SetScript("OnLeave", function(this) - if not this.selected then - this.highlight:Hide() - end - end) - label:SetScript("OnClick", function(this) - if not this.selected then - this.selected = true - if not self.multiselect then - for index, items in pairs(self.labels) do - if self.labels[index] ~= this and self.labels[index].selected then - self.labels[index].selected = false - self.labels[index].highlight:Hide() - end - end - end - else - this.selected = false - end - Label_OnClick(this) - end) - end - - local function GetItem(self, text) -- find an object based on the text parameter - for _, value in pairs(self.labels) do - if value.text:GetText() == text then - return value - end - end - return nil - end - - local function GetText(self, value) -- get the text of a label object - for _,item in pairs(self.labels) do - if value == item then - return item.text:GetText() - end - end - return nil - end - - local function SetText(self, value, text) -- set the text of a label object - for _, item in pairs(self.labels) do - if value == item then - value.text:SetText(text) - end - end - end - - local function IsSelected(self, value) -- return if the label object is currently selected - for _, item in pairs(self.labels) do - if value == item then - return item.selected - end - end - return nil - end - - local function GetSelected(self) -- return a table of the currently selected label objects - local selectedList = {} - for _, item in pairs(self.labels) do - if item.selected then - table.insert(selectedList, item) - end - end - return selectedList - end - - local function SetItemList(self, list) -- create new labels from a list of strings - for _,item in pairs(self.labels) do - item:Hide() - item:ClearAllPoints() - end - - self.labels = {} - - if list then - for _,item in pairs(list) do - if type(item) == "string" then - self:AddItem(item) - elseif type(item) == "table" then - if item.string ~= nil and type(item.string) == "string" then - if item.color ~= nil then - if type(item.color) == "table" and item.color.r ~= nil and item.color.g ~= nil and item.color.b ~= nil then - self:AddItem(item.string, item.color) - else - assert(false and "setitemlist: item.color is set, but nonsense") - end - else - self:AddItem(item.string) - end - else - assert( false and "setitemlist: item is table without .string member") - end - else - assert(false and "SetItemList: nonsense list entry") - end - end - end - end - - local function RemoveItem(self, item) -- delete an item - local function RedrawFrame() - for index,value in pairs(self.labels) do - value:SetPoint("TOPLEFT", self.labelframe, "TOPLEFT", 0, (-(index-1) * 18)) - value:SetPoint("TOPRIGHT", self.labelframe, "TOPRIGHT", 0,(-(index-1) * 18)) - end - end - - for index, value in pairs(self.labels) do - if value == item then - table.remove(self.labels, index) - item:Hide() - item:ClearAllPoints() - RedrawFrame() - end - end - end - - local function SetSelected(self, item, value) - if value then - if not self.multiselect then -- test - for _, value in pairs(self.labels) do - value.selected = false - value.highlight:Hide() - end - end - item.selected = true - item.highlight:Show() - else - item.selected = false - item.highlight:Hide() - end - end - - local function Constructor() -- widget constructor - local frame = CreateFrame("Frame", nil, UIParent) - local backdrop = CreateFrame("Frame", nil, frame) - local self = {} - local labels = {} - - self.type = widgetType - self.frame = frame - self.backdrop = backdrop - self.labels = {} - self.multiselect = true - frame.obj = self - - local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") - label:SetJustifyH("LEFT") - label:SetPoint("TOPLEFT", 5, 0) - label:SetPoint("TOPRIGHT", -5, 0) - label:SetHeight(14) - label:SetText("MultiSelect") - self.label = label - - backdrop:SetBackdrop(FrameBackdrop) - backdrop:SetBackdropColor(0, 0, 0) - backdrop:SetBackdropBorderColor(0.4, 0.4, 0.4) - backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -14) - backdrop:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -5, 0) - - local scrollframe = CreateFrame("ScrollFrame", format("%s@%s@%s", widgetType, "ScrollFrame", tostring(self)), frame, "UIPanelScrollFrameTemplate") - scrollframe:SetPoint("TOPLEFT", backdrop, "TOPLEFT", 5, -6) - scrollframe:SetPoint("BOTTOMRIGHT", backdrop, "BOTTOMRIGHT", -28, 6) - scrollframe.obj = self - self.scrollframe = scrollframe - - local labelframe = CreateFrame("Frame", nil, scrollframe) - labelframe:SetAllPoints() - labelframe.obj = self - scrollframe:SetScrollChild(labelframe) - self.labelframe = labelframe - - -- method listing - self.OnAcquire = OnAcquire - self.SetLabel = SetLabel - self.AddItem = AddItem - self.SetWidth = SetWidth - self.SetMultiSelect = SetMultiSelect - self.SetItemList = SetItemList - self.GetItem = GetItem - self.RemoveItem = RemoveItem - self.GetText = GetText - self.SetText = SetText - self.IsSelected = IsSelected - self.GetSelected = GetSelected - self.SetSelected = SetSelected - - AceGUI:RegisterAsWidget(self) - return self - end - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) -end -
--- a/Options.lua Wed Mar 14 22:06:19 2012 -0400 +++ b/Options.lua Thu Mar 15 08:47:41 2012 -0400 @@ -1,5 +1,5 @@ - -bsk.options = { +setfenv(1,bsk) +options = { name= 'bsk', type = 'group', args = @@ -9,7 +9,7 @@ type = "execute", name = "Version query", desc = "Check others' versions", - func = function(self) self:Print("TODO") end + func = function(self) bsk:Print("TODO") end } } }