-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyTemplateMenu.lua
47 lines (37 loc) · 1.16 KB
/
MyTemplateMenu.lua
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
local MyTemplate = MyTemplate or {}
function MyTemplate.CreateMenu(savedVars, defaults)
local LAM = LibStub:GetLibrary("LibAddonMenu-2.0")
local panelData = {
type = "panel",
name = MyTemplate.name,
displayName = name,
author = MyTemplate.author,
version = MyTemplate.version,
registerForRefresh = true,
registerForDefaults = true,
slashCommand = "/mytemplate", -- needs to be case insensitive, or it won't work
}
LAM:RegisterAddonPanel("MyTemplate_OptionsPanel", panelData)
local optionsData = { -- optionsData
{ -- checkbox: use global settings
type = "checkbox",
name = "use global settings",
getFunc = function() return MyTemplate.settings.useGlobalSettings end,
setFunc = function(value) MyTemplate.set("useGlobalSettings", value, true) end,
},
--[[
{ -- button 1
type = "button",
name = "button1",
func = MyTemplate.button1,
},
{ -- checkbox 1
type = "checkbox",
name = "checkbox1",
getFunc = function() return MyTemplate.get("checkbox1") end,
setFunc = function(value) MyTemplate.set("checkbox1", value) end,
},
]]
}
LAM:RegisterOptionControls("MyTemplate_OptionsPanel", optionsData)
end