They do retain independent values, one set of script locals for each instance. For example, if you have two buttons that use the same behavior, button 1 will retain its script local values and button 2 will retain its own (different) set of values.

On 7/2/18 1:42 PM, Bob Sneidar via use-livecode wrote:
Okay, so apparently I cannot use script local variables in a behavior. Setting 
the variables in a handler in a behavior script does not retain the values when 
that handler exits, like they do in a normal object script. Should they?

The workaround for me is to simply get the custom property of each stack (an 
array in each stack containing all the values I need) and then reference the 
array values directly instead of trying to set script local values. The 
downside to this is I have to get the array in every handler in the behavior 
script. Not a big deal, but I was trying to be efficient by only having to 
initialize the values once upon every openStack.

Bob S


On Jul 2, 2018, at 10:05 , Bob Sneidar via use-livecode 
<use-livecode@lists.runrev.com> wrote:

Hi all. I nailed this down, and it is indeed as someone surmised, that even 
though the script editor variable watcher indicated that script local variables 
had the correct values, it was showing me the BEHAVIOR's script local variable 
values, and NOT those for the STACK, which were in fact still empty (not 
initialized).

This is likely going to bite others in the butt in the future, who use the same 
script local variables in their behaviors as they do in their parent script. 
Who knows, maybe I'm going to be the only one in the history of LC to try this, 
but I just thought I'd toss that out there, in case anyone else gets obscure 
bugs where a statement ought to work and doesn't.

Bob S


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to