Page 1 of 1
When to use slot local variables?
Posted: Mon Feb 05, 2018 9:32 pm
One thing that has alluded me is slot local variables. I do not quite understand when to declare them. The example used in the developers manual is MIDI but when I looked at the code for the stock libraries it was used all over the place. Exactly how can you tell what parameters need to be declared as a slot local variable?
Re: When to use slot local variables?
Posted: Tue Apr 10, 2018 12:55 am
https://developer.steinberg.help/displa ... +Variables
"If some functions in your script depend on global variables that store the state of MIDI events, the automatic synchronization of global variables is usually a hindrance, because the global variables will be overwritten by the slot that received the latest MIDI events. To attain global variables that operate independently per slot, use defineSlotLocal."
So in other words it is used if you have the same lua program in 2 or more slots and want them to independent global variables.