Custom Scripts (Lua)

 INFORMATION:
 Upgrade to Professional
 View upgrade Instructions

Overview

 

Lua is a fast lightweight, powerful scripting language that will allow users to to write their own custom scripts and Macros.

 

Scripts can be triggered by multiple events on your MASSO controller such as turning on or off the spindle, triggering of various alarms, or calling a custom Mcode from your Gcode file.

There is provision to allow the user to add a custom script before and after a tool change to allow more flexibility in existing tool changers For example the spindle may need to be orientated to a particular position in case of a 5 axis spindle before a tool change and reorientate back to the original position after the tool change. If a completely different tool change logic is required then the user can write their own tool change logic to suit their machine and requirements.

 

 


Some great examples of use cases:

 


Some great examples of use cases:

 

  • Automatic warm-up routine – Run a spindle warm-up sequence automatically when MASSO powers up.

  • Auto shutdown after job – When a job finishes, check spindle temperature, turn off mist/flood, and safely power down after a delay.

  • Dynamic job timer – Use M.sys.get_job_runtime() to display elapsed job time or send a message to myWorkshop devices.

  • Auto tool offset verification – After a tool change, probe tool length and compare it with the stored offset. Display a warning if it exceeds tolerance.

 

 

 


Custom UI & Machine Behaviour

 

  • Custom button actions – Assign on-screen buttons to run Lua scripts (e.g. “Clamp Material” activates multiple outputs in sequence).

  • Dynamic screen messages – Display live information such as material type, part count or next maintenance time.

 

 

 

 


Smart IO & Integration

 

  • External device integration – Communicate with barcode scanners, scales or PLCs via serial or TCP/IP.

  • Smart mist/flood control – Automatically select mist for aluminium and flood for steel based on a Lua variable in G-code.

  • Conveyor or robot integration – Trigger part removal and wait for a “done” signal before continuing.

  • Automatic barcode label printing – Send ZPL/PCL commands using M.printer.write() to print QR labels with job data.

 

 


Production & Process Tracking

 

  • Serial number generator – Automatically increment and print serial numbers for each part.

  • Predictive maintenance tracking – Log spindle hours and notify when servicing is due.

  • Tool life management – Switch to a backup tool after a set number of uses or machining time.

  • Cloud reporting – Send job completion data to MASSO Link or myWorkshop at the end of a cycle.

 

 

 

 

 


Machine & Motion Customization

 

  • Custom homing sequences – Create unique homing logic for specialised machines.

  • Dynamic feedrate adjustment – Modify feedrate or spindle speed based on load or input signals.

  • Adaptive machining – Adjust Z offsets if a probe detects material variation.

  • Maintenance mode – Start in a safe mode if a specific input is active during power-up.

  • Jog automation – Move axes to preset maintenance positions with safety checks.

 

 

 

 


Labelling, Printing & Communication

 

  • QR label printing (ZPL) – Print labels including serial number, job name and operator.

  • Custom PCL reports – Send formatted shift or maintenance reports to a laser printer.

  • Barcode part tracking – Read serial numbers via serial input and load the correct G-code automatically.

 

 

 

 


IoT & Cloud Connectivity

 

  • Machine heartbeat signal – Send job status updates to an IoT server or MQTT broker.

  • Remote alerts – Send notifications when a job ends, a tool breaks, or an error occurs.

  • Live production dashboard – Log cycle times for real-time dashboards or OEE tracking.

 

 

 

 


Advanced Applications

 

  • Automatic pallet changer control – Manage pallet rotation, clamping and verification.

  • Laser marker integration – Send commands to engrave serial or QR codes.

  • Temperature-controlled machining – Monitor temperature and adjust feeds and speeds.

  • Custom probe cycles – Create advanced probing routines with conditional logic.

  • Adaptive logic – Use sensor inputs (e.g. vibration or current) to adjust or stop machining if needed.

 


Script Protection

 

  • Scripts can be password protected if you wish to create and sell your own scripts.

 

  • You can also:

  • Limit scripts to a specific MASSO serial number

  • Lock part of the script while leaving certain variables editable

  • This allows machine-specific settings to be changed while protecting the core logic.

     

 

 

 

 

 


Lua License Acknowledgment

This product includes the Lua programming language, developed by PUC-Rio (Pontifical Catholic University of Rio de Janeiro).

 

Lua is distributed under the MIT Licence.

 

Copyright © 1994–2024 PUC-Rio

 

Permission is granted, free of charge, to use, copy, modify, merge, publish, distribute, sublicense and/or sell copies of the software, subject to the conditions of the MIT Licence.

 

The software is provided “as is”, without warranty of any kind.

 

For more information, visit: www.lua.org.