Hello Guest it is April 17, 2021, 06:58:54 AM

Author Topic: lua panel and scripting help  (Read 600 times)

0 Members and 1 Guest are viewing this topic.

Offline gorf23

*
  •  165 165
    • View Profile
lua panel and scripting help
« on: January 26, 2019, 10:03:21 PM »
I have a dro created and I setup some io registers if a write to the register from update script its fine the new register value is shown in  the register

I also have a lua panel in one of my tabs that I am using the exact same writeregister function and the same values but from the lua panel the register isn't changing ...

does this need to be done different from a lua panel ? the writeregister function is in the screen load script

thanks gary

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: lua panel and scripting help
« Reply #1 on: January 27, 2019, 03:02:58 AM »
Lua Panels are not Global and run in their own private environment so cannot see any functions that are declared within the screen load script, and equally anything that is declared in a panel cannot be seen by the GUI. But there is a simple way around this, when leaving the GUI editor a file called ScreenScript.lua is saved which is a copy of your screen load script. We simply load this into the panel giving it access to all the functions that were created there.

Code: [Select]
dofile(mc.mcCntlGetMachDir(0)..'\\ScreenScript.lua')
DazTheGas
Theres always time for a choccy biccy

Offline gorf23

*
  •  165 165
    • View Profile
Re: lua panel and scripting help
« Reply #2 on: January 27, 2019, 09:41:24 AM »
thanks daz

I did figure it reread the scripting doc and seen you can't call a function from the screen load script so I tried this in the lua panel
     mc.mcRegGetHandle
    mc.mcRegGetValueLong()

and that did work so good to go now...

do have another question writing a plugin what is needed besides v studio?

thanks gary   

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: lua panel and scripting help
« Reply #3 on: January 27, 2019, 09:45:51 AM »
Dialogblocks is very good for the screen eliments, oh and lots of coffee ;-)

DazTheGas
Theres always time for a choccy biccy

Offline gorf23

*
  •  165 165
    • View Profile
Re: lua panel and scripting help
« Reply #4 on: January 27, 2019, 11:51:32 AM »
The coffee is no problem :)

the code will be say you want a plugin to setup some registers and maybe use lua scripts to utilize the plugin

do you think its above a modest programmers level, and I haven't been able to find any docs or much info on the subject

thanks gary