Hi, when I try
Lua Code:
local name = "checkButton"
local template = "UICheckButtonTemplate"
local checkButton = CreateFrame("Button", name, UIParent, template)
checkButton:SetPoint("CENTER", 0, 0)
checkButton.text = _G[name.."Text"]
checkButton.text:SetText("Hello World")
checkButton:SetScript("OnClick", function(self, event, arg1)
if self:GetChecked() then
print("Button is checked")
else
print("Button is unchecked")
end
end)
I got an error :
Message: Interface\AddOns\GearHelper\GearHelper.lua:834: attempt to call method 'GetChecked' (a nil value)
Time: Thu Aug 4 16:34:28 2016
Count: 2
Stack: Interface\AddOns\GearHelper\GearHelper.lua:834: in function <Interface\AddOns\GearHelper\GearHelper.lua:833>
Locals: self = MyExampleCheckButton {
0 = <userdata>
text = MyExampleCheckButtonText {
}
}
event = "LeftButton"
arg1 = false
(*temporary) = nil
(*temporary) = MyExampleCheckButton {
0 = <userdata>
text = MyExampleCheckButtonText {
}
}
(*temporary) = "attempt to call method 'GetChecked' (a nil value)"
|
Do you have any clue ?