Include

<< Click to Display Table of Contents >>

Navigation:  Reference >

Include

GPScript has a textual include mechanism, similar to (but not quite the same as)  that used by C. There are two forms

 

Include "name"

 

 

Include "/path/to/file"

 

The former will look for a file in the default Scripts folder underneath your Documents/Gig Performer location. The latter lets you define an absolute path to the location of the script you want to include. If you do not include the file extension (.gpscript) it will be appended automatically so your actual include files must have that extension.

 

The include mechanism is very simple and it is a compile-time error if the file you want to include does not exist. Note that an included file will not be included more than once, even if it is included from multiple places, i.e. nested includes.

 

It is recommended that you only keep "globally useful" functions in included files and beware of name clashes. If you include two different files each of which contains a function or variable with the same name, that will be a compile time error, even if the actual declarations are identical.