Hello Guest it is March 29, 2024, 12:42:25 AM

Author Topic: List of Mach4 error codes  (Read 4542 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: List of Mach4 error codes
« Reply #10 on: December 11, 2017, 03:47:55 AM »
A little example, if you open up the screen editor and use the dummy button under the DRO`s and add the code

Code: [Select]
local rc = -3
wx.wxMessageBox(mcErrorCheck[rc])

This will give you the error of "attempt to index global 'mcErrorCheck' (a nil value)"
Now if you use

Code: [Select]
if (mc.mcInEditor() == 1) then
    dofile(mc.mcCntlGetMachDir(0).."\\Modules\\mcErrorCheck.lua") -- use F10 in the debugger for this line to step over it to save debugging the file.
end

local rc = -3
wx.wxMessageBox(mcErrorCheck[rc])

This will work fine, however it is advised you press F10 on the line indicated to save debugging the module too

DazTheGas
New For 2022 - Instagram: dazthegas

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: List of Mach4 error codes
« Reply #11 on: December 11, 2017, 05:56:14 AM »
OK, I can see that. Thanks Daz.

What I was asking was this........

If your example code was in a macro (say m200) would it run if loading the error check module was only done once in the screen load script and not done in the load modules macro?

It was explained to me that adding the mcLoadModules macro to the macros folder would load the modules added by it into the chunk that all of the macros become, mcLua.mcc. making the contents of those loaded modules available to all macros in the macros folder. I took what you were saying to mean that if a module was loaded in the screen load script then loading it in the load modules macro would not be necessary because the contents of it would already be available to macros. If that is the case then something definitely changed.

I can test it (and I will) faster than ask about it once I'm back in the shop.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: List of Mach4 error codes
« Reply #12 on: December 11, 2017, 06:08:41 AM »
Simple answer no, when running macros`s they are using their own lua stack with bindings to the core api, the gui also has its own lua stack with bindings to the core api. This goes the same with the debugger, when opened it appears to also have its own lua stack connected to the core api. when loading modules, functions or tables etc they are loaded within the stack that called them and not accessible from another stack.

Does this make any sense, i`m losing myself  ;D ;D

DazTheGas
New For 2022 - Instagram: dazthegas

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: List of Mach4 error codes
« Reply #13 on: December 11, 2017, 07:04:37 AM »
Ok, thanks Daz,

Yup, makes perfect sense and a very clear way of explaining it. It's that word "Global" that's a little misleading I think. Maybe we should call it Regionally Global.  ;D
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!