Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
DataCollector.lua File Reference

Go to the source code of this file.

Functions

DataTracker SetTrackerState (config_name, state)
 Set the on/off state of a named custom tracker via the DataCollector plugin.
DataTracker ToggleTracker (config_name)
 Send a toggle event for a named custom tracker via the DataCollector plugin.
DataTracker ClickTracker (config_name)
 Send a click event for a named custom tracker via the DataCollector plugin.
DataTracker new (config_name, current_state)
 Create a new DataTracker instance for a custom data collector tracker.
DataTracker SetState ()
 Set the state of this tracker instance.
DataTracker Toggle ()
 Send a toggle event for this tracker instance.
DataTracker Click ()
 Send a click event for this tracker instance.

Function Documentation

◆ Click()

DataTracker Click ( )

Send a click event for this tracker instance.

Delegates to DataTracker.Click() using the config_name stored on this instance. A click event represents a momentary or counted interaction with the tracker.

Note
Documentation generated by AI on 2026-03-03

◆ ClickTracker()

DataTracker ClickTracker ( config_name )

Send a click event for a named custom tracker via the DataCollector plugin.

Sends a "click" command to the DataCollector plugin for the specified tracker using w.RegSendCommand(). A click event represents a momentary or counted interaction.

Parameters
config_name(string) The internal configuration name of the tracker to click
Note
Documentation generated by AI on 2026-03-03

◆ new()

DataTracker new ( config_name ,
current_state  )

Create a new DataTracker instance for a custom data collector tracker.

Registers a new custom tracker with the DataCollector plugin via w.RegSendCommand(). If only one of pretty_name or config_name is provided, the other defaults to the same value. Periods and semicolons are stripped from config_name to ensure compatibility with the DataCollector API command format. If the tracker already exists, creation is silently ignored. If creation fails for any other reason, w.Error() is raised.

Parameters
pretty_name(string|nil) The human-readable display name for the tracker. If nil, defaults to config_name
config_name(string|nil) The internal configuration name used in API commands. Periods and semicolons are removed. If nil, defaults to pretty_name
current_state(number|nil) The initial numeric state of the tracker. Defaults to 0 if nil or non-numeric
Returns
(table) A DataTracker object instance with config_name set and metatable configured
-- Create a tracker with both names
local tracker = DataTracker:new("Spindle Running", "SpindleRunning", 0)
-- Create a tracker with a single name
local tracker = DataTracker:new("CoolantOn", nil, 1)
CommonDualTableScreenV02 DualTable Create()
Create and initialize a dual table instance for the specified Mach4 instance.
DataTracker new(config_name, current_state)
Create a new DataTracker instance for a custom data collector tracker.
name("m3")
Handle M3 plasma cutting start failure by reporting an alarm or error based on machine state.
Warning
Raises w.Error() if both pretty_name and config_name are nil, or if tracker creation fails for a reason other than the tracker already existing
Note
Documentation generated by AI on 2026-03-03

◆ SetState()

DataTracker SetState ( )

Set the state of this tracker instance.

Delegates to DataTracker.SetState() using the config_name stored on this instance. Accepts the same state values as DataTracker.SetTrackerState(): 1/true/"on" or 0/false/"off".

Parameters
state(number|boolean|string) The desired state. Accepts 1, true, or "on" to enable; 0, false, or "off" to disable
Note
Documentation generated by AI on 2026-03-03

◆ SetTrackerState()

DataTracker SetTrackerState ( config_name ,
state  )

Set the on/off state of a named custom tracker via the DataCollector plugin.

Sends an "on" or "off" command to the DataCollector plugin for the specified tracker using w.RegSendCommand(). Accepts multiple representations of true/false to allow flexible calling conventions. Raises w.Error() if state is nil or not a recognized value.

Parameters
config_name(string) The internal configuration name of the tracker to update
state(number|boolean|string) The desired state. Accepts 1, true, or "on" to enable; 0, false, or "off" to disable. Any other value raises an error via w.Error()
-- Enable a tracker using boolean
DataTracker.SetTrackerState("SpindleRunning", true)
-- Disable a tracker using string
DataTracker.SetTrackerState("SpindleRunning", "off")
-- Enable a tracker using number
DataTracker.SetTrackerState("CoolantOn", 1)
CommonGUIModule Scheduler Enable()
Enable the scheduler and load the top scheduled file into Mach4.
Warning
Raises w.Error() if state is nil or not one of: 1, true, "on", 0, false, "off"
Note
Documentation generated by AI on 2026-03-03

◆ Toggle()

DataTracker Toggle ( )

Send a toggle event for this tracker instance.

Delegates to DataTracker.Toggle() using the config_name stored on this instance. A toggle event switches the tracker between its on and off states.

Note
Documentation generated by AI on 2026-03-03

◆ ToggleTracker()

DataTracker ToggleTracker ( config_name )

Send a toggle event for a named custom tracker via the DataCollector plugin.

Sends a "toggle" command to the DataCollector plugin for the specified tracker using w.RegSendCommand(). A toggle event switches the tracker between its on and off states.

Parameters
config_name(string) The internal configuration name of the tracker to toggle
Note
Documentation generated by AI on 2026-03-03