LUA Triggers
Overview
The LUA Trigger System allows users to automatically execute Lua scripts when specific system events occur inside the controller.
Triggers make it possible to extend functionality, automate tasks, and integrate custom behaviours without modifying the firmware.
Each trigger represents a predefined system event such as power-on, homing, tool change, or a user interface action. When that event occurs, the controller executes the user-defined Lua logic associated with that trigger.
How Triggers Work
A trigger links a system event to a Lua script.
When the event occurs, the registered script is executed immediately in the Lua environment.
Triggers can be used for logging, safety validation, automatic actions, or custom control functions.
Most triggers execute automatically and do not return values, but some (for example, tool-change-related triggers) can return control signals such as continue, skip, or abort depending on the user logic.
Trigger Categories
To make the Lua Trigger System clear, organized, and easy to use, all available triggers are divided into categories based on their function and the part of the controller they interact with.
Each category represents a logical group of related system events — for example, System, Homing, I/O, Tool Change, or Alarms.
This structure helps users quickly locate the specific triggers they need for a given task and understand the context in which each trigger operates.
Grouping triggers also ensures scalability: as new features or subsystems are added to the controller (such as new peripherals or automation modules), new triggers can be introduced within the relevant group without affecting existing ones.
From a functional perspective, trigger categories reflect how different parts of the controller interact during a machining process.
For example:
System triggers handle global or start up-related events.
Homing and motion triggers focus on machine setup and positioning.
I/O and safety triggers react to external hardware changes such as inputs, E-stop, or door sensors.
Process triggers like Spindle, Coolant, and Tool Change correspond to operational states of the CNC cycle.
Interface triggers connect Lua scripts to user actions or visual interface components.
Job triggers provide flexible user-defined points for automation or job tracking.
By grouping triggers in this way, the system maintains a consistent and predictable logic flow — allowing both advanced integrators and general users to easily design reliable, event-driven automation inside the controller.
Each trigger within a category has a well-defined purpose and event timing, making it straightforward to decide when and why to attach a Lua script to it.
System Triggers
System triggers are general-purpose events linked to the controller’s operating state. They can be used to initialise values, run background checks, or respond to system-level actions.

System - On Power Up
Description: Executes once when the controller powers on. Commonly used to set up variables or initial conditions.
Supported in MASSO software v5.13 & API Version: 1.0.0
System - Background
Description: Runs continuously in the background at regular intervals. Useful for ongoing monitoring. It can be used for lightweight monitoring tasks such as checking system states or updating variables.
Supported in MASSO software v5.13 & API Version: 1.0.0
Homing Triggers
Homing triggers provide control before, during, and after the homing sequence.

Homing - Before Homing
Description: Executes before the homing process begins.
Supported in MASSO software v5.13 & API Version: 1.0.0
Homing - After Homing
Description: Runs when the homing process finishes successfully.
Supported in MASSO software v5.13 & API Version: 1.0.0
Homing - Homing Error
Description: Executes if a homing failure or limit error occurs.
Supported in MASSO software v5.13 & API Version: 1.0.0
Estop Triggers
Estop triggers provide control when the Estop button is presses and after it is released

E-Stop - Pressed
Description: Executes immediately after the E-Stop button is pressed
Supported in MASSO software v5.13 & API Version: 1.0.0
E-Stop - Released
Description: Executes immediately after the E-Stop button is released
Supported in MASSO software v5.13 & API Version: 1.0.0
Door Triggers
Estop triggers provide control when the Estop button is presses and after it is released

Door_Opened
Description: Executes immediately after the Door is opened
Supported in MASSO software v5.13 & API Version: 1.0.0
Door Closed
Description: Executes immediately after the Door is closed
Supported in MASSO software v5.13 & API Version: 1.0.0
Tool Change Triggers
Tool change triggers manage actions before, during, and after automatic or manual tool changes.

Tool Change - Before Tool Change (M6)
Description: Runs before the tool change starts; can return values to control the process.
Supported in MASSO software v5.13 & API Version: 1.0.0
Tool Change - After Tool Change (M6)
Description: Runs after the tool change completes.
Supported in MASSO software v5.13 & API Version: 1.0.0
Tool Change - Tool Change Error
Description: Triggered when a tool change error occurs.
Supported in MASSO software v5.13 & API Version
Graphical Interface Triggers
Graphical interface triggers allow integration of user interface events with Lua scripts.

Graphical Interface - Action Button 1–16
Description: Executes when a specific action button is pressed on the interface.
Supported in MASSO software v5.13 & API Version

Job Triggers
Job triggers are used to execute scripts at the beginning and end of machining jobs.

Job - End of Job
Description: Executes when a job finishes or is stopped.
Supported in MASSO software v5.13 & API Version
Spanish
French
German
Simplified Chinese