Welcome to the third installation of learning to code with JW Lua for Finale. So far, we’ve learned the basics of the Lua language and have written one small script in JW Lua. Today, we’re going to expand on the script we wrote last time to help us really get more comfortable, while introducing another really important aspect of coding: the if statement.
And by now, you might start to see why JW Lua can be incredibly powerful in Finale. Though you haven’t really written much, you can already start to see that the ability to create loops and edit the music on the page can really speed up your workflow.
But we’re still missing one key ingredient: logic.
And that’s why we use if statements in programming. It allows the code to start making intelligent choices, which will allow you to code up many of your repetitive tasks instead of doing them all by hand.
Welcome to the second article on learning to code with JW Lua.
In the first article, we learned some of the basics of the lua language, including datatypes and for loops. Today, we’re going to take that knowledge and apply it with creating an actual script that changes every notehead in a selected region.
JW Lua is quickly becoming a popular plug-in for Finale because of it’s unbelievable potential for improving your Finale workflow. It’s over 300 times faster than FinaleScript, more flexible than your macro program of choice, and connects directly to Finale’s codebase. Which means it can save you lots of time while achieving better results, regardless of what “better” means to you.
There’s just one problem:
Because it’s written in a language not known by all programmers, and is a highly customized version of that language, it can appear daunting to learn how to code with it. It can seem even harder if you’ve never coded before.
I suppose a good place to start is with the question “What exactly is Lua?”
Lua is a lightweight computer programming language (the complete Lua distribution could fit on a floppy disk) designed primarily for use within other applications (think plugins) to increase functionality and productivity of the host software program.
Video games are a good example. In recent years, Lua has risen to become a lingua franca for scripting in video games as diverse as World of Warcraft and Angry Birds. For programmers with an interest in this area, this means that your Lua programming skills are transferable from company to company.
Lua’s construct of simple, flexible meta-features can be extended as needed, rather than supplying a feature-set specific to one software program. This makes Lua an ideal and powerful tool for music notation software.
History & Trivia: Lua was created in 1993 by members of the Computer Graphics Technology Group (Tecgraf) at the Pontifical Catholic University of Rio de Janeiro (PUC-Rio), in Brazil. In 2011, Lua was honored with Game Developer Magazine’s Front Line Award in the programming tool category.
‘Lua’ is the Portuguese word for ‘moon’. In Roman mythology, ‘Lua’ was the Goddess to whom soldiers sacrificed captured weapons.
In my opinion, Finale is a great music notation program, and probably the most flexible one available. However, there are little quirks about the program that can cause more frustration than they need to.
That’s where plug-ins come in.
Because plug-ins are created by Finale users just like you and me to solve these quirks and make our engraving lives faster, easier, and less frustrating.
And luckily, a while back Jari Williams created JW Lua, a scripting language for efficiently coding your plug-ins. With this plug-in, several developers have started to develop custom scripts that you can start running today.