Include
The Include function inserts an additional script file, or "chunk", into a script file. The external chunk is compiled and executed when the Include statement is executed. Any chunk may Include other chunks.
Include( sPath )
Most scripts need to load classes to work with images, plots, files, and so forth. Mira includes its collection of classes in compiled form. If you need to include other class definitions, use the Include function in the chunk that uses the class. For example, suppose you have created a class named CMyClass and want to use it in a chunk. You have two choices for making the class available to the script chunk: 1) include the entire class's source code in the chunk where it is used, or 2) define the class in its own file and then Include that file in the chunk where CMyClass is needed. In this example, suppose you saved the class definition file in [Mira]\Scripts\Classes\CMyClass.lua. Then you would use the following syntax to include the class definition in a chunk:
Note that, as in the C language, a double backslash \\ is always needed in a literal string unless you want the character following to be interpreted as an escape sequence—regardless of whether it actually does form a legal escape sequence. For example,\\t results in a backslash \ plus the letter t, whereas \t results in a tab character being imbedded into the string.
Several useful functions are provided as script chunks with the Mira Pro Script 7 distribution. These are located in the folder [Mira]\Scripts\Include. To access any of these functions from a script chunk, you need to use the Include functions. For example, to include the function in the file LoadImages.lua, place the following statement in your script anywhere before the first use of the LoadImages() function:
The above example uses a relative path which begins at the level of the Scripts subfolder inside the Mira installation. If no machine name or drive is specified, Mira interprets sPath as descending from the [Mira]\Scripts folder. Alternatively, you can specify sPath as an absolute path that contains the drive letter, such as C:. Using an absolute path allows the included file to be located anywhere in the file system.