Script Only Stack Behaviors and Nesting

Bob Sneidar bobsneidar at
Mon Jul 2 20:42:43 CEST 2018

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 at> 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

More information about the use-livecode mailing list