Lua Triggers

 INFORMATION:
 Upgrade to Professional
 View upgrade Instructions

 


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.

 

 

INFORMATION: These can be found by selecting Custom Scripts (LUA) in the MASSO F1-Setup screen

 


Trigger Categories

Triggers are grouped into logical categories based on function.

 

This makes them easier to find and understand.

 

Categories reflect how different parts of the controller operate during machining.

 

 

Examples:

 

  • System – Startup and global events

  • Homing – Machine positioning

  • I/O & Safety – Inputs, E-Stop, door sensors

  • Process – Spindle, coolant, tool change

  • Interface – User actions

  • Job – Start and end of machining jobs

 

 

Grouping triggers this way keeps the system structured and scalable.

 

As new features are added to MASSO, new triggers can be included in the appropriate category.

 

 

INFORMATION: Not all trigger categories shown on the right-hand side of the Custom Scripts window are currently active. Additional triggers (such as M-Codes, Spindle and Auto Tool Zero Probe) will be added in future software updates.

 


System Triggers

System triggers relate to the controller’s operating state.

 

 

They are typically used to:

 

  • Initialise variables

  • Run background checks

  • Respond to controller events

     

 

 


System – On Power Up

 

Description:


Runs once when MASSO powers on.

 

Common uses:

 

  • Set variables

  • Initialise system states

 

Supported in MASSO software v5.13 API Version: 1.0.0

 


System – Background

 

Description:


Runs continuously at regular intervals in the background.

 

Common uses:

 

  • Monitor system states

  • Update variables

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 

WARNING: Do not use heavy or time-consuming code in this trigger.

 

Avoid:

 

  • Complex loops

  • File operations

  • Long calculations

 

Keep this trigger short and efficient to prevent performance issues.

 

 


Recovery – Safe Mode

If a Lua script prevents MASSO from starting, you can use Safe Mode.

 

 

Safe Mode:

 

  • Prevents all Lua scripts from loading

  • Allows access to the Admin account

  • Lets you disable or fix the faulty script

 


 

 


Entering Safe Mode

 

  1. Connect an external keyboard to MASSO.
    (The external USB port on MASSO Touch can be used.)

  2. Restart the controller.

  3. When the screen appears, immediately press the F8 key repeatedly.

  4. Continue pressing until the Safe Mode warning appears.

 

 

If the Safe Mode message does not appear within 5 seconds, reboot and try again.

 

While in Safe Mode:

  • User login is disabled

  • Only the Admin account can log in

 

After fixing or disabling the script, reboot MASSO normally.

 


Homing Triggers

Homing triggers control actions before, during and after homing.

 

 

 


Homing – Before Homing

 

Description:
 

Runs before the homing process begins.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


Homing – After Homing

 

Description:


Runs after homing completes successfully.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


Homing – Homing Error

 

Description:


Runs if a homing failure or limit error occurs.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


Estop Triggers

E-Stop triggers control actions when the emergency stop button is pressed or released.

 

 

 


E-Stop – Pressed

 

Description:


Runs immediately after the E-Stop button is pressed.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


E-Stop – Released

 

Description:


Runs immediately after the E-Stop button is released.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


Door Triggers

Door triggers control actions when the door sensor changes state.

 

 

 


Door – Opened

 

Description:


Runs immediately after the door sensor is opened.

 

Supported in MASSO software v5.13 & API Version: 1.0.0

 


Door – Closed

 

Description:


Runs immediately after the door sensor 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 tool changes.

 

 

 


Tool Change – Before Tool Change (M6)

 

Description:


Runs before the tool change starts.

 

This trigger can return control values to influence the tool change 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:


Runs if a tool change error occurs.

 

Supported in MASSO software v5.13 & API Version

 


Graphical Interface Triggers

These triggers link user interface actions to Lua scripts.

 

 

 


Graphical Interface – Action Button 1–16

 

Description:


Runs when a selected action button is pressed on the interface.

 

Supported in MASSO software v5.13 & API Version

 

 

 


Job Triggers

Job triggers allow automation at key job events.

 

 

 


Job – End of Job

 

Description:


Runs when a job finishes or is stopped.

 

Supported in MASSO software v5.13 & API Version