1611
Mach4 General Discussion / Re: Anyone know how to select tabs with an external input signal?
« on: March 21, 2020, 11:30:39 PM »
Hi,
excellent work!
As if often the case once you have devised a strategy for achieving a particular goal the actual coding
of it is trivial.
As a matter of programming style; directly using the 'scr.*********' table is not recommended. In most cases there is
an API or Mach variable that is 'exposed' for the purpose of customization...not withstanding the the scr.********* functions
can do the job. That is Smurph's recommendation anyway.
I myself am rather mystified by the syntax of the scr.********* table. I did find and post a list of the table entries:
https://www.machsupport.com/forum/index.php?topic=40051.msg271116#msg271116
Smurph has rather pointedly reminded us all to avoid many of the functions contained therein.
In this instance however you are using one of the basic and popular scr.********* functions and should be OK. The fact that
you have used the SigLib{} table speaks very well of the effort to learn Mach/Lua. Most newcomers settle for 'polling'
an input in the PLC script. The SigLib{} approach is FAR more elegant.
I too use Mach4Hobby but am not aware that MachIndustrial has any extra features related to this thread. Although I do
now recall that Mach4Industrial does make use of some of the scr.********* functions for a specific editing purpose....
although the details escape me. That's the good thing about Alzhiemer's...your always meeting some new!
Craig
excellent work!
As if often the case once you have devised a strategy for achieving a particular goal the actual coding
of it is trivial.
As a matter of programming style; directly using the 'scr.*********' table is not recommended. In most cases there is
an API or Mach variable that is 'exposed' for the purpose of customization...not withstanding the the scr.********* functions
can do the job. That is Smurph's recommendation anyway.
I myself am rather mystified by the syntax of the scr.********* table. I did find and post a list of the table entries:
https://www.machsupport.com/forum/index.php?topic=40051.msg271116#msg271116
Smurph has rather pointedly reminded us all to avoid many of the functions contained therein.
In this instance however you are using one of the basic and popular scr.********* functions and should be OK. The fact that
you have used the SigLib{} table speaks very well of the effort to learn Mach/Lua. Most newcomers settle for 'polling'
an input in the PLC script. The SigLib{} approach is FAR more elegant.
I too use Mach4Hobby but am not aware that MachIndustrial has any extra features related to this thread. Although I do
now recall that Mach4Industrial does make use of some of the scr.********* functions for a specific editing purpose....
although the details escape me. That's the good thing about Alzhiemer's...your always meeting some new!
Craig