Hi,
I think you'll have to use registers, indeed much of the reason for having them is to communicate between Lua chunks.
Mach has at least two Lua chunks, the GUI and the Cgode interpreter. They cannot run simultaneously and so in any session of Mach control passes back and forth
between these two chunks. No variables in one chunk are available in the other. Registers are required.
A related idea is that if you require Mach execute a movement say, then Mach's control state must be MC_STATE_IDLE (as opposed to in use). You might require an MDI move say, so Machs
control state would have to be MC_STATE_IDLE and then when the MDI started to execute it would change to MC_STATE_MRUN. If you now wish to access the GUI and execute some functions there you will have
to find the means of wresting control from the MC_STATE_MRUN state back to MC_STATE_IDLE and THEN cause the GUI chunk to run. You have found that a RESET is sometimes required to wrest control from the current chunk.
http://www.machsupport.com/forum/index.php/topic,36548.0.htmlI have a list of Machs states as a text document and put it in the Docs folder that I might have it at hand when coding. I have found that at certain times it is necessary to determine Machs current state
before you attempt certain calls, otherwise the call will fail, sometimes unpredictably and sometimes you can crash Mach.
My understanding of this stuff is very rudimentary at best but even a little understanding can demystify Mach considerably.
Craig