Bob Hall wrote:

> So I guess I need to understand what is the TTL definition of a
> script local variable?

In the engine, script-local variables will retain their values throughout the session.

If a script is edited, however, by default the recompilation of the script causes the script-local variables to be cleared.

This default can be overridden with the preserveVariables property. False by default, when set to true script-local variables will retain their values between compilations of the script they appear in.

I had previously thought that the preserveVariables was a global property, which would mean its value is preserved throughout the session, and that the "Variable Preservation" checkbox in the "Script Editor" section of Prefs reflected that value.

However, the Dictionary does not specify that the preserveVariables is a global property, and there appears to be no relationship between the seemingly-related Prefs checkbox and this property - recipe:

1. In the Message Box, run: put the preserveVariables
2. In the MB, set the preserveVariables to the opposite
3. Open the Prefs window, note the checkbox
4. Close the Prefs window
5. In the MB, set the preserveVariables to its opposite
6. Open the Prefs window, not that the checkbox retains the true/false state seen before, even though the property itself has changed.

The Dictionary does say:

   The preserveVariables property is provided as a background
   compatibility aid. It should not, in general, be used in
   user scripts as the IDE automatically handles preservation
   of variables via the Variable Preservation option in the
   preferences and Script Editor Script menu.

So while I once thought I'd understood both the property and the seemingly-related Prefs setting, apparently I do not.

Guidance from the IDE team would be welcome here.

 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to