PP access to Operation variables in the var. table

This may not be the correct place but it is as close as I can find in the blogs, so here goes.

I have a need to be able to use tool variables like var.ZigzagPocketOperation0_CutDepth

mainly the CutDepth for router operations to generate G-Code to control my Z axis via the post.

I am using the same tool on a different layer. So that the var ends up var.ZigzagPocketOperation4_CutDepth.

However in the post I want to be able to use a LUA wild card for the numeric portion and this does not seem to be possible. How can I use the tool Variables say CutDepth regardless of the operation number

I note to the above: my CNC is completely home built, controller and all.

@Loren , I moved this to a new thread.

You can access global var ‘cutDepth’ of the current Operation within the post processor (pp) directly by the name ‘cutDepth’, you don’t need the Operation name and index number to qualify it. Hopefully this solves your ask. Tip: when you set a breakpoint in the sheetcam debugger, you can examine the Stack in the split debugger window, the stack has local and global variables currently in scope that you can reference in your code.

Otherwise, Read/Write access to an Operation variable in “var.” table in a pp is also possible using a dynamic variable name that you construct as a string var in the post processor. For example code on how to do this, see the following thread and either pp attached to it. Post Processor Example w Custom Options popup window - #13 by sheetcamCS2
This statement in either of those pps will demo some Lua code as such.
_G[varName] = _G[varName..mSCOx] -- assign from SCO field

see also the Lua doc here- Lua 5.1 Reference Manual - contents