-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.lua
More file actions
executable file
·81 lines (71 loc) · 1.79 KB
/
config.lua
File metadata and controls
executable file
·81 lines (71 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local addonName, ns, _ = ...
local config = {
['CueDB'] = {
useBattleNet = false,
leaveExistingGroup = false,
}
}
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
if not AceConfig or not AceConfigDialog then return end
local function GetSetting(info)
local settingTable = info[#info - 1]
local settingName = info[#info]
return _G[settingTable][settingName]
end
local function SetSetting(info, value)
local settingTable = info[#info - 1]
local settingName = info[#info]
_G[settingTable][settingName] = value
end
local optionsTable = {
type = 'group',
args = {
--[[ ['CueLocalDB'] = {
type = 'group',
inline = true,
name = 'Individual Settings',
order = 1,
args = {},
}, --]]
['CueDB'] = {
type = 'group',
inline = true,
name = 'Shared Settings',
order = 2,
args = {},
},
},
get = GetSetting,
set = SetSetting,
}
local function GenerateMidgetConfig()
for namespace, _ in pairs(optionsTable.args) do
wipe(optionsTable.args[namespace].args)
for key, value in pairs(config[ namespace ]) do -- _G[namespace]
if type(value) == 'boolean' then
optionsTable.args[namespace].args[ key ] = {
type = 'toggle',
name = key,
-- desc = '',
}
elseif type(value) == 'number' then
optionsTable.args[namespace].args[ key ] = {
type = 'range',
name = key,
-- desc = '',
min = -200,
max = 200,
bigStep = 10,
}
end
end
end
return optionsTable
end
-- In case the addon is loaded from another condition, always call the remove interface options
if AddonLoader and AddonLoader.RemoveInterfaceOptions then
AddonLoader:RemoveInterfaceOptions(addonName)
end
AceConfig:RegisterOptionsTable(addonName, GenerateMidgetConfig)
AceConfigDialog:AddToBlizOptions(addonName)