|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| Loader | Require (gui_parent_prefix, scr_prefix) |
| Load the GUI parent module and versioned screen module for a Mach4 screen. | |
| Loader | RequireCommonMCodeModulesAndGlobals (machine_specific_module, optional_aux_module) |
| Perform common setup tasks (initialize globals, load modules, etc.). | |
| Loader | RequireOEMUserGUIModule (user_module) |
| Load and return the OEMUserGUIModule from the profile's Macros/Scripts directory. | |
| Loader | RequireUserAuxModule (user_module) |
| Load and return the UserAuxModule from the profile's Macros/Scripts directory. | |
| Loader Require | ( | gui_parent_prefix | , |
| scr_prefix | ) |
Load the GUI parent module and versioned screen module for a Mach4 screen.
This is the public-facing wrapper around Loader._Require(). It calls _Require() inside a pcall() so that any Lua errors during module loading are caught and displayed to the user via a wxWidgets message box rather than propagating as unhandled exceptions. The versioned screen module name is constructed as "<scr_prefix>V##" where ## is the zero-padded value of the global SCREEN_VERSION (defaulting to 1 if not set). The loaded screen module is attached to the GUI module as GUIModule.screen.
| gui_parent_prefix | (string) The name of the GUI parent module to load (e.g., "MillGUIModule") |
| scr_prefix | (string) The base name of the screen module without the version suffix (e.g., "MillScreen" will load "MillScreenV01" when SCREEN_VERSION is 1) |
| Loader RequireCommonMCodeModulesAndGlobals | ( | machine_specific_module | , |
| optional_aux_module | ) |
Perform common setup tasks (initialize globals, load modules, etc.).
Loader.RequireCommonMCodeModulesAndGlobals
This function is invoked by MCodeHeaderFile.mcs in /Profiles/<profile>/Macros/
| machine_specific_module | This is the M code module specific to the machine type, like "MillMCodeModule" or "TurnMCodeModule". |
| optional_aux_module | If not nil, this aux module (code shared between both M code and GUI modules) is loaded as the global aux. |
Perform common setup tasks for M-code execution (initialize globals, load modules, etc.)
This function is invoked by MCodeHeaderFile.mcs in /Profiles/<profile>/Macros/ and serves as the primary initialization entry point for all M-code chunk execution. It performs the following major tasks in order:
If any required module fails to load, an error is logged via w.Log() and a warning dialog is displayed to the user. Optional modules log failures without showing dialogs.
| machine_specific_module | (string) The name of the machine-type M-code module to load as the global m (e.g., "MillMCodeModule" or "TurnMCodeModule") |
| optional_aux_module | (string|nil) If not nil, the name of an auxiliary module to load as the global aux and merge into m. Conflicting keys in m are overridden by aux with a warning logged. |
| Loader RequireOEMUserGUIModule | ( | user_module | ) |
Load and return the OEMUserGUIModule from the profile's Macros/Scripts directory.
Checks if an OEMUserGUIModule.mcs file exists in the current profile's Macros/Scripts directory. If found, it clears the cached module and attempts to load it via w.pcall(). If loading succeeds, the provided user_module reference is replaced with the loaded OEM module and a success message is logged. If loading fails, an error is logged but no exception is raised. If the file does not exist, the original user_module is returned unchanged.
| user_module | (table) The existing user module table to potentially replace with the loaded OEM module |
| Loader RequireUserAuxModule | ( | user_module | ) |
Load and return the UserAuxModule from the profile's Macros/Scripts directory.
Checks if a UserAuxModule.mcs file exists in the current profile's Macros/Scripts directory. If found, it clears the cached module and attempts to load it via w.pcall(). If loading succeeds, the provided user_module reference is replaced with the loaded module. If loading fails, an error is logged but no exception is raised. If the file does not exist, the original user_module is returned unchanged.
| user_module | (table) The existing user module table to potentially replace with the loaded aux module |