Works a treat!

mcErrorCheck.lua goes in the Mach4\Modules directory

load_modules.mcs and m100.mcs go in the Mach4\Profiles\Profile your using\Macros folder. If your replacing existing files and they have a compiled
version (FileName.mcc) delete the mcc file before launching Mach.
Delete the Lua.mcc before launching Mach.

Need to add this bit to the screen load script  (load modules section) if you want it to work from a gui script (buttons clicked script for example).

--ErrorCheck module
package.loaded.mcErrorCheck = nil
ec = require "mcErrorCheck"