contents   index   previous   next



IDENTIFYING A VARIABLE

 

The majority of ScriptEase API functions work with variables, retrieving or modifying their values. All the functions share a common way to identify which variable you want to work with. You specify the object and member that the variable resides at as parameters to each function. ScriptEase provides a number of predefined objects that you can use which cover all of the places variables are stored internally. The most common is SE_GLOBAL, the global object. Each such object is fully explained below. Note that SE_GLOBAL, SE_THIS, and so forth are the names of the object. You pass that exact text to the function to identify that as the object you want to work with.

 

Later, when we discuss the API functions for examining variables, we will see it is possible for a variable itself to be an object. In that case, seGetObject will return an object handle for the object the variable contains. This handle, since it is an object, can be used instead of SE_GLOBAL or the other stock objects in further variable identifications. In this way, starting from the top-level objects you can access any variable on the system.

 

While it is possible to access any variable in this way, it is not always convenient. For instance, let's say you want to get at the variable foo[5].goo. You could do this in steps. You would get foo as a member of the global object. After seeing that it is itself an object, you could get the numeric member 5 from it. That gives yet another object from which you could extract the final member goo. Not only is that ugly and difficult to understand, but there could be other caveats. A script, when it refers to foo, might not be getting a global variable. foo could be a local variable, or it could be found because the code is inside a with statement. Trying to program all the possibilities would be tedious, lengthy, and error prone.

 

Fortunately, ScriptEase provides an API call to do this for you. seVarParse will take an arbitrary variable name, such as a or foo[5].goo and tell you what object and member name it is referring to. Once you have the object and member name, you are ready to call any of the variable access functions we will describe below to examine or modify that variable. Most of the API function that take an object/member pair can also use the SE_COMPOUND types to parse arbitrary variable names.

 


LIST OF MEMBER SPECIFIERS

LIST OF STOCK OBJECTS