Hello Guest it is March 28, 2024, 01:33:52 PM

Author Topic: Macro calling module loaded in Screenscript - HELP  (Read 206 times)

0 Members and 1 Guest are viewing this topic.

Macro calling module loaded in Screenscript - HELP
« on: March 01, 2023, 04:56:37 AM »
Hi Everyone - 

I'm new to this and part of this debugging journey is learning Mach4 and Lua - Please have patience with me if I get detail wrong - I'm here to learn.

I'm struggling to get the M3 macro (Plasma Profile)  to fire the mcTHC module.   This module is loaded by the ScreenScript.lua when Mach4 loaded.  It seems to me that the Macro dont have access to modules that is running in the ScreenScript. 

What blows my mind is this -  When I run older versions of Mach4 this works - Mach4 v4.2.0.4612 - But as soon as I run a newer version - It falls apart. 

I've even tried to write my own stupid module that only create a window text box - require it in the screen load script (same as mcTHC).  But I'm unable to call the module from the M3 macro.   

Now - I do understand that Zero Brane Editor is not the same environment as the scripts running in the screen - Thus it is expected to get global Nil errors.   

BUT

If I require the module inside the M3 macro and debug, it works and the module is called only from the Script Editor(debug).   If i try to run the M3 macro from Gcode or MDI nothing happens.  I've tested with a simple textbox popup inside the macro also - It does not run. Remove the require, and the textbox pops up - But then the module fails.

I'm very lost and confused - Please - If I miss something please guide me on the right path.