Fix global use of some variables

This commit is contained in:
rilgamon 2021-03-12 11:08:28 +01:00
parent b640e23e1b
commit 112e77efa2
4 changed files with 20 additions and 19 deletions

View File

@ -114,8 +114,8 @@ function lib:AddConfigEntry(options, ...)
} }
end end
options['args'][input[1]] = menu options['args'][input[1]] = menu
return menu
end end
return menu
end end
function lib:AddConfigMenu(options, parentName, handler, order, more) function lib:AddConfigMenu(options, parentName, handler, order, more)
local menu = { local menu = {

View File

@ -15,25 +15,24 @@ function lib:GetLDB(objname)
return ldb:GetDataObjectByName(objname) return ldb:GetDataObjectByName(objname)
end end
function lib:AddLDB(objname, obj, db) function lib:AddLDB(objname, obj, db)
local obj = obj or {} local obj = obj or {}
obj['type'] = obj['type'] or 'launcher' obj['type'] = obj['type'] or 'launcher'
obj['text'] = obj['text'] or objname obj['text'] = obj['text'] or objname
if(obj['type '] == 'launcher') then if(obj['type '] == 'launcher') then
obj['OnClick'] = obj['OnClick'] or proto_OnClick obj['OnClick'] = obj['OnClick'] or proto_OnClick
end end
if(ldb) then if(ldb) then
local ldbobj = ldb:GetDataObjectByName(objname) or ldb:NewDataObject(objname, obj) local ldbobj = ldb:GetDataObjectByName(objname) or ldb:NewDataObject(objname, obj)
if(ldbobj) then if(ldbobj) then
if(not ldbicon:IsRegistered(objname)) then if(not ldbicon:IsRegistered(objname)) then
db['global']['ldbicons'] = db['global']['ldbicons'] or {} db['global']['ldbicons'] = db['global']['ldbicons'] or {}
local sb = db['global']['ldbicons'] local sb = db['global']['ldbicons']
sb[objname] = sb[objname] or CopyTable(defaults) sb[objname] = sb[objname] or CopyTable(defaults)
-- print('reg', objname) ldbicon:Register(objname, ldbobj, sb[objname])
ldbicon:Register(objname, ldbobj, sb[objname])
end
end end
return ldbobj
end end
return ldbobj end
end end
function lib:Embed(target) function lib:Embed(target)
for _,name in pairs(mixins) do for _,name in pairs(mixins) do

View File

@ -32,6 +32,7 @@ posFrame:SetScript("OnEvent", function(self, event, ...)
mailRec = nil mailRec = nil
mailSum = nil mailSum = nil
end) end)
local lastframe = posFrame
local function GetFactionList() local function GetFactionList()
local n,m,_ local n,m,_
local l = {} local l = {}

View File

@ -42,10 +42,11 @@ local function getSumWeek()
end end
return sumWeekOut,sumWeekIn return sumWeekOut,sumWeekIn
end end
local connectedRealms
local function Helper_Tooltip3(realm) local function Helper_Tooltip3(realm)
if(not db['connectedRealms']) then return end if(not db['connectedRealms']) then return end
connectedRealms = connectedRealms or GetAutoCompleteRealms() connectedRealms = connectedRealms or GetAutoCompleteRealms()
for k, v in pairs(connectedRealms) do for k, v in pairs(GetAutoCompleteRealms()) do
if(v == realm) then if(v == realm) then
return true return true
end end