We are now going to have a look at some of the key formatting-related operators which
are widely used in Lumerical's scripting language.
Adding comments in the script is essential for better understanding it.
A good comment can also help reduce the time for modifying the script in the future.
In Lumerical script, a comment begins with '#' and ends when a new line starts.
You can also use keyboard shortcuts - Ctrl+R to comment and Ctrl+T to uncomment.
For multiple line comments, you just need to add '#' for every comment line by manually
entering them or by first selecting the lines and pressing 'Ctrl+R'.
It can also be placed after an executable script command.
For any script to work, it should end with a semicolon.
It is ok to leave out the semicolon in the Script Prompt, where the semicolon will be
automatically added when missing.
However, this will cause an error when used in the Script File Editor in a file.
Blank lines, space and tab are ignored in the script.
So the following script in three lines is interpreted in the same way as this one in
a single line.
In many cases, it might be necessary to print out the results on screen for testing and
To do that, simply add '?' at the start of the script line.
If you want to make the script more readable and understandable by utilizing the indentations,
use 'Ctrl+]' keyboard shortcut to add 4 spaces to the current line or all selected
To remove the indentation, use 'Ctrl+[' instead.
A smart indent, 'Ctrl+I', will smart indent all selected lines or the entire document
if nothing is selected.
For selected lines, it will first round first non-whitespace line to the nearest integer
multiple of 4 spaces and then begin the indent from there.
When applying the smart indent to the entire document, it will remove all leading whitespaces
on the first non-whitespace line, and then continue from there, using a 4-space indent.
The above features are also available in the context menu when you right-click your mouse
in the Script File Editor.