Reset Locals?
    Trevor DeVore 
    lists at mangomultimedia.com
       
    Wed Jul  5 22:18:13 EDT 2006
    
    
  
On Jul 5, 2006, at 6:37 PM, Scott Rossi wrote:
> OK, script local variables are persistent now in 2.7.x.  In the  
> readme, if I
> read it correctly, it appears one must do the following to reset  
> the local
> values:
>
>   set the script of <targetobject> to tNewScript
>
> Is this correct?  Do we really need to set the script to itself (or  
> another
> script) to reset the variables?
>
> The above works here, but this process seems to be, well, unusual.   
> I would
> think I would be able to somehow access the local variables via  
> script and
> reset them.  Please let me know if I'm missing something.
Scott,
script locals are only preserved across script compilation if you
set the preserveVariables to true
Otherwise 2.7 behaves as previous engines.  If you set  
preserveVariables to true AND you want your script locals to reset  
each time you compile then declare them as follows:
local myVariable = ""
This gives the variable a default value each time the script  
compiles.  If you want the variable to retain it's value even after a  
script is compiled then declare it like this:
local myVariable
Hope this makes sense,
-- 
Trevor DeVore
Blue Mango Learning Systems - www.bluemangolearning.com
trevor at bluemangolearning.com
    
    
More information about the use-livecode
mailing list