-
Posted by becial on Mon, 21 Sep 2015 06:30:06
I am making an addon which when you use the slash command /cta the frame will hide and if it's hidden already the frame will show. Should be basic enough. However when I call MyFirstFrame_Frame:Hide() I receive this error:
``Message: [string "MyFirstFrame_Frame:OnHide"]:1: attempt to index global 'this' (a nil value)
Time: 09/20/15 23:02:00 Count: 1 Stack: [string "*:OnHide"]:1: in function <[string "*:OnHide"]:1> [C]: in function `Hide' Interface\AddOns\MyFirstFrame\MyFirstFrame.lua:6: in function `?' Interface\FrameXML\ChatFrame.lua:4454: in function `ChatEdit_ParseText' Interface\FrameXML\ChatFrame.lua:4108: in function `ChatEdit_SendText' Interface\FrameXML\ChatFrame.lua:4147: in function `ChatEdit_OnEnterPressed' [string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1> Locals: self = MyFirstFrame_Frame { 0 = <userdata> TimeSinceLastUpdate = 11.113000558689 } (*temporary) = nil (*temporary) = nil (*temporary) = "attempt to index global 'this' (a nil value)"``
The Main Frame AddOn Frame I am trying to hide to hide the whole addon is created in XML as: ``
<Frame name="MyFirstFrame_Frame" enableMouse="true" movable="true"> --various layers strings etc here Script for including my lua is also above </Frame>
`` The Offending Lua is as such: `` SLASHCTA1 = '/cta'; CTAVISIBILITY = true;
function MyFirstFrame_handler(msg, editbox)
if CTA_VISIBILITY then MyFirstFrame_Frame:Hide(); CTA_VISIBILITY = false; else if not CTA_VISIBLITY then MyFirstFrame_Frame:Show(); CTA_VISIBLITY = true; end end
end SlashCmdList["CTA"] = MyFirstFrame_handler;``
The Error posted first pops up when it hits MyFirstFrame_Frame:Hide(); Been stuck on this for a while, seems like this should be simple to show or hide a frame built in XML based on a slash command. Any help would be appreciated.