11
Mach4 General Discussion / Re: How to make Lua wait for signal state to change
« on: December 07, 2017, 09:39:36 PM »
Ok, so that is working. What is the safest way to exit a macro on error? For instance, if the signalwait times out then I don't want to continue the macro, but I need to turn a couple outputs off. So I have:
if (rc==mc.MERROR_TIMED_OUT) then
hsig, rc=mc.mcSignalGetHandle(inst, loosendraw)
mc.mcSignalSetState(hsig, 0)
mc.mcCntlSetLastError(inst, "TIMED OUT")
end
This works, but does it stop the macro at this point? Does it exit the macro? I definitely would not want the next line of code to be run.
if (rc==mc.MERROR_TIMED_OUT) then
hsig, rc=mc.mcSignalGetHandle(inst, loosendraw)
mc.mcSignalSetState(hsig, 0)
mc.mcCntlSetLastError(inst, "TIMED OUT")
end
This works, but does it stop the macro at this point? Does it exit the macro? I definitely would not want the next line of code to be run.