Ju
ne
20
18
Legrand PDU User Guide 225
Note: For a serial RS-232 or USB connection between a computer and the Legrand PDU, leave it at the
default (115200 bps).
Lua Scripts
If you can write or obtain any Lua scripts, you can create or load them into the Legrand PDU to control its
behaviors.
Legrand also provides some Lua scripts examples, which you can load as needed.
Note: Not all Legrand Lua script examples can apply to your Legrand PDU model. You should read each
example's introduction before applying them.
You must have the Administrator Privileges to manage Lua scripts.
Writing or Loading a Lua Script
You can enter or load up to 4 scripts to the Legrand PDU.
Tip: If you can no longer enter or load a new script after reaching the upper limit, you can either delete any
existing script or simply modify/replace an existing script's codes. See
Modifying or Deleting a Script
(on
page 228).
To write or load a Lua script:
1. Choose Device Settings > Lua Scripts >
.
2. Type a name for this script. Its length ranges between 1 to 63 characters.
The name must contain the following characters only.
Alphanumeric
characters
Underscore
(_)
Minus
(-)
Note: Spaces are NOT permitted.
3. Determine whether and when to automatically execute the loaded script.
Checkbox
Behavior when selected
Start automatically at
system boot
Whenever the Legrand PDU reboots, the script is
automatically executed.
Restart after
termination
The script is automatically executed each time after 10
seconds since the script execution finishes.
4. (Optional) Determine the arguments that will be executed by default.
a. Click
.
b. Type the key and value.
c. Repeat the same steps to enter more arguments as needed.
To remove any existing argument, click
adjacent to it.
Note: The above default arguments will be overridden by new arguments specified with the "Start with
Arguments" command or with any Lua-script-related event rule. See
Manually Starting or Stopping a
Script
(on page 226) or
Start or Stop a Lua Script
(on page 204).
5. In the Source Code section, do one of the following. It is recommended to leave the Enable Syntax
Highlighting checkbox selected unless you do not need different text colors to identify diverse code
syntaxes.