Hello Guest it is April 16, 2024, 04:11:07 PM

Author Topic: Can I create an Library of functions outside the Screen Load Script?  (Read 819 times)

0 Members and 1 Guest are viewing this topic.

I have 30 or so custom functions that I wrote to interface over serial with some servo drives. Each one reads or writes a unique piece of data such as servoGetPositon(). These are taking up a lot of space in my screen load script and I would like to move them somewhere else to maintain readability without changing the functionality.

I am not a programmer so the phrasing I'm going to use is probably wrong, but is there a way to save all these functions in a "library file" and "include" this at the top of the screen load script? something like #include "servoScript.h" from C++? Does Mach/LUA support this?

Thanks!
Re: Can I create an Library of functions outside the Screen Load Script?
« Reply #1 on: April 24, 2019, 12:06:15 PM »
Hi,
I think a module is what is required.

https://www.machsupport.com/forum/index.php?topic=35007.0

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Can I create an Library of functions outside the Screen Load Script?
« Reply #2 on: April 24, 2019, 01:45:58 PM »
Thanks!

I'm going to have to watch that about 10 times to get it, but that looks perfect!
Re: Can I create an Library of functions outside the Screen Load Script?
« Reply #3 on: April 25, 2019, 10:30:44 PM »
Converted all my custom functions to modules. Took a little effort but well worth it. Functionality has not changed (that's what I wanted)