Hi All,
have proven to myself, yet again, how little I know about Lua.
Writing some code yesterday to help a bloke out and elected to put two signals in the SigLib (signal load script) and have two
global variables AtSpeed and IsStopped be written with the state of the input pin.
My intention was to use the variables in m3, m4 and m5 scripts but came unstuck, the variable was not valid in
the macros.
My understanding was that any code in the screen load script was available to all other code within Mach, clearly
my understanding is wrong/incomplete/completely out to lunch!
I've read several explanations of lexical scoping but just when I thought I had it fixed in my mind its goes astray on me.
Does anyone have an explanation or a link to an explanation that may help? Making intelligent use of scoping is a vital
part to extracting the most from Lua.
Craig