Using #include



Scripts can include other scripts using the format:
#include "otherscript.rs"
This will include the other script file in the same way that the C-preprocessor works. That is, the contents of the other file will be included as if you had copy+pasted it in directly.


Finding the included files
The file to include will be searched for starting from the location of the file which includes it. As an example, suppose you have script files in this folder structure:

In this situation, you could use includes like this to bring the contents of the 'other' script files into 'myscript.rs':
#include "inc/otherScript1.rs"
#include "inc/otherScript2.rs"
In cases where #include is used in a script that is not saved in a file of its own (for example, a 'live' script in the script panel), the file to include will be searched for starting from the location of the .rube file it relates to.

If the .rube file has not yet been saved, or if the included path begins with a '/', the file to be included will be treated as an absolute path.


About error reporting
After other files are included, the entire script is compiled as a single block of text. This means that if errors are encountered while compiling, the error line numbers reported by the script compiler will be incorrect when #includes are used. Hopefully this can be improved in future.


Notes for Windows users
The path to the included file uses the Qt path convention, so even on Windows the slashes in include paths should be forward slashes '/', not backslashes.