Local variables reset
-
Could we have a way, perhaps a keyword, that would allow variables declared within functions to retain their value. Currently the only way I see to do this is to declare the variables outside of the function.
-
Why would you want to do that? It introduces all kinds of problems with reference counting which could lead to memory leaking if the local scope doesn't get cleaned (I explicitly added resetting local variables to prevent this).
For what scenario would you need to retain the local values?
-
It's not a big deal, I can definitely live without it but thought I'd ask in case it was something simple to add. For example I have a legato function that stores the time the last legato note was played and checks it when the next legato note is played to determine what action to take. This variable is only needed within the legato function so declaring it globally just adds a bit of clutter.
-
I've actually rethought this and decided to take a more modular approach to my script so this feature is probably not important at all, unless someone else needs it.
-
Well, there is only you and me until now :)