The Plugin Editor is not just an editor. It is also a debugger. It allows you to step through your code one line at a time, and inspect the value of variables. It also allows you to set breakpoints (see Debugging for more information about breakpoints), and to step into, or out of functions. You can open the Plugin Editor from the main Plugins Window, by clicking the button, selecting a plugin and clicking . If you click , the Plugin Editor will be opened to allow you to enter the code for the new plugin. You can also open the Plugin Editor by clicking on any plugin in the list using the right mouse button, and then choose 'Edit...' from the menu that appears.
The Plugin Editor window is split into three areas: the Text Pane (top), the Output Pane (bottom-left), and the Variable Pane (bottom-right). The Text Pane is where the actual plugin 'script' (also called 'code') is entered. The Output Pane will display information about any syntax errors with your code. If your script uses the Lua standard 'print' command (sometimes useful for debugging), output from this command is also displayed in the Output Pane. The Variable Pane in the bottom right will show the currently available variables in the plugin, when the debugger is active and the script is at a breakpoint.
| Go |
Run the plugin in the debugger. The code will execute
until a break-point is hit. You can also use the Go
command to continue execution after a break-point has been hit. |
| Step Into |
Executes the current line of code
(or starts the debugger if you are not already running).
If the current line of code is a call to a Lua function, the
debugger will step into the function. |
| Step Over | Similar to 'Step Into' except that if the current line of code
is a call to a Lua function, the debugger will execute that call
and step over it (i.e. not step into the function). |
| Step Out |
If the current line of code is within a function, the debugger
will execute the rest of the code in that function and will
break after exiting from that function. |
| File > New |
Create a new plugin (clears the Plugin Editor). |
| File > Open | Open an existing plugin. |
| File > Save | Saves changes to the plugin |
| File > Save As | Saves changes to the plugin under a new name |
| File > Encoding | The current file encoding: ANSI or UTF-8 |
| Edit > Undo | Undo the last edit |
| Edit > Cut | Cut the selected text to the clipboard |
| Edit > Copy | Copy the selected text to the clipboard |
| Edit > Paste | Paste the clipboard contents into the current text position |
| Edit > Insert Script Header | A script header is a comment section at the top of a plugin which contains information about the plugin. It is strongly recommended for all plugins (and needed for report type plugins). This menu command will insert a blank script header at the top of the plugin. You can then edit this to supply all the required details. |
| Edit > Insert Script Outline | Inserts the outline for a typical script, to get you started. The outline script includes not only the script header, but also some initialisation code and an initial 'main' function. You are recommended to declare all functions before calling a starter function (normally 'main'), with a line at the end of the plugin. This practice is illustrated by the outline script. |
| Edit > Insert Data Reference | Convenient helper tool for inserting data references into the code. |
| Edit > Select All | Select all the code in the text pane |
| Edit > Find | Find selected text in the text window |
| Edit > Replace |
Find and replace selected text with replacement text |
| Edit > Go To Line |
Move to a specified line number |
| Edit > Clear Output |
Clears the Output Window |
| Debug > Go |
See Toolbar commands above |
| Debug > Break |
When the code is running under the debugger, causes it to
break (pause execution) |
| Debug > Stop Debugging |
Stop debugging |
| Debug > Step Into |
See Toolbar commands above |
| Debug > Step Over | See Toolbar commands above |
| Debug > Step Out | See Toolbar commands above |
| Debug > Set/Clear Breakpoint |
Sets or clears a breakpoint on the current line |
| Debug > Clear All Breakpoints |
Clears all breakpoints |
| Debug > Inspect Variable |
Opens a small window to display the contents of the currently
selected variable in the Variables Pane (during a debugging
session). You can also open it by double-clicking on a
variable in the Variables Pane. |
| Debug > Debug Mode |
If you start a debugging sessions when Debug Mode is enabled
(by clicking Go, or one of the Step commands), a global variable
DEBUG_MODE will be predefined with value true.
This means that you can condition some parts of your code on
this variable and that part of the code will only execute if you
run the plugin under the debugger, with Debug Mode
enabled. This feature can be used with any plugin but is
particularly useful with special plugin types, such as
report-type plugins or language-type plugins. In Debug Mode, Family Historian may also perform additional checks which are not performed when plugins are run normally. If issues are found as a result of these checks, warning messages will be displayed in the Output window of the debugger. |
| Debug > Options |
Opens Debugger Options |
| Debug > Run |
Runs the script in the same way that it would ordinarily be
run from the Plugins Window - i.e. not under the
debugger. |
| View > Line Numbers |
Display line numbers down the left-hand side. |
| View > Fonts |
Choose fonts for the Text Pane and Output Pane. |