Understanding the structure of menu scripts
Posted: Thu Mar 15, 2018 7:14 pm
Hi all, I'm new to LUA and MOHO, so I'm afraid I'm struggling to figure out the structure / format of scripts. I was hoping someone could help me out.
I'm not new to programming in general, though I'm not an expert either. So the general concepts of variables, functions, loops, and so on make sense to me. But what I'm not comprehending is how menu scripts are actually invoked. I found a few sample menu scripts online, but I couldn't parse out which function is the base function - in other words, when I open the menu in MOHO and click on the script, which function does it call first? I can see there are functions that are called on mouse action and key presses, but I couldn't find one for menu selection.
I thought at first that it would just play from the top of the script when you selected it from the menu, but that doesn't seem to be the case. It looks like the script starts running as soon as you launch MOHO, and then constantly checks to see if it's enabled and relevant. But those functions just return booleans, and don't seem to call the functions that do the heavy lifting.
Hopefully I explained my confusion clearly. Could anyone give me pointers here? I'm just not sure how to make my script actually launch when I select it from the menu.
Thanks so much!
N
I'm not new to programming in general, though I'm not an expert either. So the general concepts of variables, functions, loops, and so on make sense to me. But what I'm not comprehending is how menu scripts are actually invoked. I found a few sample menu scripts online, but I couldn't parse out which function is the base function - in other words, when I open the menu in MOHO and click on the script, which function does it call first? I can see there are functions that are called on mouse action and key presses, but I couldn't find one for menu selection.
I thought at first that it would just play from the top of the script when you selected it from the menu, but that doesn't seem to be the case. It looks like the script starts running as soon as you launch MOHO, and then constantly checks to see if it's enabled and relevant. But those functions just return booleans, and don't seem to call the functions that do the heavy lifting.
Hopefully I explained my confusion clearly. Could anyone give me pointers here? I'm just not sure how to make my script actually launch when I select it from the menu.
Thanks so much!
N