Intro to Lua for GrandMA3
Hey lighting folks! The following is the transcript from my YouTube video, Intro to Lua for GrandMA3
This is the introduction video for my Lua for GrandMA3 Tutorial series. Please check out my channel, From Dark To Light, on YouTube, and you can find the code to go along with my tutorials here on GitHub.
Hello lighting people, welcome to my Lua for GrandMA3 tutorial series! MA3 is a powerful software and one of the greatest things about it is the ability to run Lua scripts. Unfortunately there aren't any real resources for learning Lua for MA3, so after going to the trouble to learn it the hard way I decided it would be helpful to make these tutorials to make it easier for those coming after me.
Before diving into Lua coding I wanted to make a quick intro video to show the plugin interface in GrandMA3 and introduce some other applications and workflows. Also, just get this out of the way, Lua is a word, not an acronym. Don't write it in all caps. It's Portuguese for moon, so it's not an acronym.
Before I start going into what I do and what I have to share, I'm going to share the resources that I used to learn so that if I miss something or you want to go deeper into something I didn't go into or get ahead of me you can go do your own research as well.
I used mainly lua.org which has the online version of a book called Programming in Lua.
There are newer editions that you can buy but they're pretty expensive and the online version covers most things. This is only Lua; it does not have anything to do with MA3, but it is useful for learning how Lua works outside of MA3.
The other resource I used is the MA3 user manual; it has a section on plugins. It was not very extensive when I first started doing this, but in recent versions it's added more information so you can read about plugins, about how the plugin editor works, and then you can actually see how some different functions work. I will be getting into what these actually are later but if you want to refer to any specific one, I do that very frequently and it's a great resource. It does not however go into how Lua works, only how the specific function works, so if you don't understand Lua it's going to be a little bit confusing, which is why I use both.
I wish I could recommend other YouTube channels or something but none of the ones I found actually were any good. There were none that had to do with Lua for MA3 specifically and when it comes to Lua for the world in general honestly I didn't find any that I liked, but you're welcome to look and maybe there's something new or something that works for you.
I'm going to go into MA3 now and show you the plugin editor and this, this is my view that I use for working with plugins in MA3. I have the command line history on half of the screen, the system monitor on the other half, and then the plugins down here. Basically both of these are going to provide information that you need to see, and obviously you have to be able to get to your plugins. So to create a plugin, like anything else, just right click or edit and then you get these lines and kind of like macros you can insert a new component and then to edit this you can't just click on it or right click on it; that will only edit the individual column. You have to hit this button down here which says edit and that opens up the editor and there's some template codes in here and some different descriptions, like, short descriptions of different API functions, but I don't refer to that very often. If it helps you that's great.
And then whenever you're closing out of this just make sure to hit save if you've made any changes you want to keep although if you hit the “X” I think it will prompt you, “do you want to save these changes or discard them?”
This editor looks pretty similar to other things in MA3, especially the macro editor, but I'm going to go into a few things that are different. So the first thing that's going to be different from macros is you can have multiple Lua components but it's not going to run all of them. So each component is just code; you put code in here and save that and whenever you call the plugin it's going to run that code, but if you have multiple Lua components only the first one is ever going to get run; the second one will never be run, the third one will never be run, unless you specifically call “Plugin 1.2,” then it specifically calls the second component so you can kind of hide code to only use it if you want to call it specifically. It can be useful but just remember only the first component is actually going to do anything under normal circumstances.
The other things that are different are the file name and file path, file size, source, all these things. You can actually point the plugin editor to a specific file within this file path in your showfile and it will take that code and import it into the plugin and you have the file name and file path for that. When you do that the file will not change in MA3 unless you run a keyword to reload it and that only works if you have this set to installed. If you do not have this set to installed then even changes you make will not translate in MA3.
That is one workflow that you can use if you are using a PC. I don't actually do that; it's easier for my brain to just have the plugin stored in a separate location outside of the showfile, edit them separately, save those files separately, and then copy and paste my code into MA3, but there are multiple ways you can do that. Another thing I will get into is just syntax error. This will turn to yes and everything will turn red if your code has an error in it, like a syntax error that it can recognize; that it'll tell you, this code won't work, and it won't let you run it. Also the file size right here is non-editable, it will just show you in bytes what size the file is wherever you have it, whether it's linked to a file in the system or you just have code in here. If I put code in here, once it gets large enough for it to tell that there's some size to it it will show you the size in bytes here.
So now that I've been over that I'm going to go into Visual Studio Code. This is the application I use for editing code and it's really useful; you'll learn how to use it easily, it's very intuitive, but in here I actually have a folder for Lua for GrandMA3 and then, this I will get into later what it actually is but that is a file you will see on my GitHub page if you go there, which again, I'll get into that in a minute but whenever you need to create a new file you can hit this button which says new file and type in a name. Whatever name you type, make sure you end it with “.lua” because that tells it what language it is and then you can edit it here and it will give you different colors for different types of keywords that you use in there, so it makes it really super intuitive to tell where things are easily, see where you might have an error, how things fit together; it even autofills things for you it's really nice and it will tell you if there are errors.
So I use Visual Studio code together with Git and GitHub which integrate easily with Visual Studio code and I'm not going to really get into that but basically Git will let you save different versions of your whole file structure and so anytime you want to save a change you save it, it's called committing, you write a message to show what changes you made and you can compare old and new versions, you can revert back to old versions anytime you need to, so if you mess something up you can go back in time and see what what an older version was and see, okay so this must be what broke it, cuz this is what I changed.
GitHub is part of Git, or it's connected to Git and GitHub is actually a website but it connects to your desktop so I have a GitHub page for my YouTube channel right here and this is that ReadME file that I saw in VSCode. It has some information about my YouTube channel, a link to my YouTube channel, and what I'm going to do is all of my files that I make to go along with these videos will be available on GitHub for you guys to see and play with and test out and just change however you want and see what you can do with them to use kind of as a starting point to refer back to what I've talked about, so when I save code it's going to be saved in GitHub as well, and that allows also multiple users to edit things, you can edit things from different devices… I do use that capability quite a bit; it's really nice but it's not necessary to get started. I'm not going to go into how to set that up but if that is a video that is desired let me know and I might think about doing it in the future.
So that's all I have for today! I'm going to make another video soon and we're going to get into Lua functions and it's going to be really exciting so I will see you in the next video, I hope you have a great day!
Comments
Post a Comment