contents   index   previous   next



Working with Variables

 

The ScriptEase engine keeps track of all variables used by the scripts you execute. The ScriptEase API provides functions to examine and modify these variables. The most common place to use these functions is in the body of wrapper functions, which are described in the next chapter. However, that is not the only place you might want to examine variables. For instance, the ScriptEase debugger executes scripts one statement at a time and lets the user examine the variables as it is doing so. The debugger uses the ScriptEase API to do this.

 

The most important concept to remember is that every variable is a member of some object. There are only a few top-level objects that store all variables and values used by ScriptEase. For instance, if a script says:

 

var a = 4;

 

That global variable a is actually a member of an object, the global object, which is one of these top-level objects. All global variables are members of this same object. Similarly, functions can have local variables and parameters, such as in this function, which are also part of an object:

 

function foo(b)

{

   var c = 10;

}

 

This function has two variables, the parameter b and the local variable c. Both are part of what is called the activation object. Each time a function is called, a new activation object is created for it. There is one global object, but there can be many activation objects. Activation objects are created for a function when it starts executing and destroyed when the function finishes. The ScriptEase API lets you access all activation objects, so you can examine or modify all local variables for functions currently being run.

 


IDENTIFYING A VARIABLE

EXAMINING VARIABLES

MODIFYING VARIABLES

USING SE.TEMP AND SE.WRAPPER_TEMP

SE.RETURN EXPLAINED