Variable types and scope....question



  • So here's todays question:

    If I have a panel with a mouse callback function declared, I cant use local declarations in those call backs right?

    so what if I call an inline function from within my mouse call back - can I use local variables there ?

    e.g.

    inline function myFunction()
    {
         local myLocal = "Hello";
         Console.print(myLocal);
    
    };
    
    
    
    const var myPanel = Content.getComponent("myPanel");
    myPanel.setMouseCallback(function(event)
    {
        if (!event.mouseUp)
        {
            if (event.clicked)
            {
               myFunction();
            }
        }
    });
    


  • Yes this should be possible - what happens when you run that script?



  • @Christoph-Hart - it seems to work....I'm just a bit warey...it practical; terms its a fair few functions being called...in a fair few places...


Log in to reply
 

14
Online

1.2k
Users

3.8k
Topics

33.6k
Posts