Hello Guest it is December 14, 2019, 02:23:50 PM

Author Topic: Define own global Variables to use in macros  (Read 160 times)

0 Members and 1 Guest are viewing this topic.

Define own global Variables to use in macros
« on: December 25, 2018, 04:09:47 AM »
In the "screen load script" I would like to define my own global variables and functions that are also available in macro scripts (m6).

I tried it with the following variables
myOwnVariable = 1;
mc.myOwnVariable = 1;

but in m6 script these are not available. when calling the scripts is executed up to this point and then the script aborted. I do not see any error message like "m6, line55: attempt to compare nil with string". Is there a log file in which such errors are written?
Re: Define own global Variables to use in macros
« Reply #1 on: December 25, 2018, 06:27:23 AM »
Hi,
the screen load script is in the GUI 'chunk' whereas the m6 macro is in the Gcode interpreter 'chunk'.

A variable in one chunk is not available in the other.

There is a way to pass data between chunks......use registers. In the Docs folder:

Quote
Mach4 CNC Controller
Lua Scripting Guide
Section 4 from page 14.

Craig
My wife left with my best friend...
     and I miss him!