Behaviors not honoring script local variables??

J. Landman Gay jacque at hyperactivesw.com
Tue Jun 26 16:30:18 EDT 2018


Every instance of a behavior maintains its own separate variable values. 
This is a feature. Globals are the solution if you want them to share 
the values.

On 6/26/18 3:19 PM, Bob Sneidar via use-livecode wrote:
> Works with globals, but not script locals.
> 
> Bob S
> 
> 
>> On Jun 26, 2018, at 13:13 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Hi all.
>>
>> I have a behavior script with a handler:
>>
>> local cTableName, cDGName, cPriKey, cAltTable1
>>
>> on getStackConstants pParentStack
>>    -- retrieve stack constants from stack property
>>    put the stackConstants of pParentStack into aStackConstants
>>    put the keys of aStackConstants into tConstantList
>>
>>    repeat for each line tConstant in tConstantList
>>       do "put " & quote &  aStackConstants [tConstant] & quote & " into " & tConstant
>>    end repeat
>> end getStackConstants
>>
>> When I trace the handler, it does indeed set the values for the local variables, but as soon as the handler exits, the script local variables are all reset! This does not happen when I do the same thing in an object script. Is there something about behaviors preventing script local variables from retaining their values??
>>
>> Bob S
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at 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         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list