Hi,
by and large the recommendation is not to the scr. table of functions, they are not well documented for a reason.
You are correct to use the mc.OSIG_MACHINE_ENABLED signal.
To read the state of a signal you first need to find its handle, another way of saying its address. Lua is a dynamic language and variables
come and go throughout the Mach session and there is NO certainty that a variables address is constant across start-ups.This is done by:
local desiredVariableHandle=mc.mcSignalGetHandle(inst,mc.OSIG_MACHINE_ENABLED)
Now you can read the variables state:
local desiredVariableState=mc.mcSignalGetState(inst,desiredVariableHandle)
You can read the variables state as many times as you like but really all you want to know is when it changes.
In Mach3 you would read the variable multiple times a second and 'do something' when the signal changed, this is called 'polling'.
Its old school and inefficient. Mach4 has a new way of doing this called the Signal Library Table and Signal Script. It takes quite a bit
of thinking about and you may think that its too complicated to do what you want but you need to make the effort because it
reveals the true power of Lua....and its far FAR in excess of VB.
May I suggest reading my .pdf on the Signal Library and Signal Script:
https://www.machsupport.com/forum/index.php?topic=40051.msg267764#msg267764Craig