Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: django013 on April 30, 2017, 11:41:28 AM

Title: accessibility of lua functions?
Post by: django013 on April 30, 2017, 11:41:28 AM
Hello,

I added a script to a tab-page onEnter, which contains a function and works so far.

Now I want to reuse that function from a buttons leftup script - and that fails. Where do I have to put functions right, so that both scripts can use it?
Title: Re: accessibility of lua functions?
Post by: DazTheGas on April 30, 2017, 01:45:08 PM
You will need to declare your functions in the Screen_Load_Script this will make it available at all objects within the Gui except the Lua Panels

DazTheGas
Title: Re: accessibility of lua functions?
Post by: django013 on May 01, 2017, 03:18:59 AM
Thanks! That was the key.

As the manual didn't mention function declarations at all, I asked Mr.Google and he gave me a helping hand :D
Function declaration is just asigning a value to a variable =:O

Works pretty well and it is completely awfull, how fast lua is :)
Title: Re: accessibility of lua functions?
Post by: django013 on May 06, 2017, 12:04:14 AM
Hello,

build 3384 broke this rule. Now no declarations from screenload script are recognized and I can not access functions. I added there.

What's the new way of doing it right?