1. Hello,

    I finally received my copy of WOW Programming and it's great! I wasn't anticipating the shear volume of content that was included. Very impressive. :-)

    I am currently trying to understand secure action buttons. I can get the sample type=spell to work without any problems; however, I cannot figure out how to use the button to call a function in my lua file whenever the button is pressed.

    I have looked over the list on p. 251 of the book, but can't find a reference to the type=function format that is mentioned. I was thinking about something along these lines, but can't get it to work:

     function myButton_Initialize()
        myButton:SetAttribute("type","function") 
        myButton:SetAttribute("function","myButtonFunction();") 
     end
    
     function myButtonFunction()
        myButtonText:SetText("Yipee!")
     end
    

    Thank you for any help that you might be able to offer.

  2. Hello,

    I finally received my copy of WOW Programming and it's great! I wasn't anticipating the shear volume of content that was included. Very impressive. :-)

    I am currently trying to understand secure action buttons. I can get the sample type=spell to work without any problems; however, I cannot figure out how to use the button to call a function in my lua file whenever the button is pressed.

    I have looked over the list on p. 251 of the book, but can't find a reference to the type=function format that is mentioned. I was thinking about something along these lines, but can't get it to work:

     function myButton_Initialize()
        myButton:SetAttribute("type","function") 
        myButton:SetAttribute("function","myButtonFunction();") 
     end
     
     function myButtonFunction()
        myButtonText:SetText("Yipee!")
     end
    

    Thank you for any help that you might be able to offer.

    That's not really how it works. Here's how it should be:

     function myButton_Initialize()
       myButton:SetAttribute("type", "myFunction")
       myButton.myFunction = function()
         myButtonText:SetText("Yipee!")
       end
     end
    

    In short, when the type attribute is set to something other than the valid options, it checks for that key in the frame table, and runs that function.

  3. Ok, that makes sense. I just couldn't find a reference that I understood before yours. :-) Again, I really appreciate your assistance and willingness to share your knowledge.

    Thanks!

  4. No worries!