Lua Editor

Site: QSC
Course: Q-SYS Control 101 Training
Book: Lua Editor
Printed by: Guest user
Date: Tuesday, 3 December 2024, 9:37 AM

Description

Lesson Description

Explore the various components that enable you to write and edit script with the Lua Editor.


Updated 11/02/18: Added references to new “Text Controller” component in Designer 7.2


Video Transcript

0:08
Now it’s time to start looking at the third method of programming, which is writing script. In Q-SYS,
0:14
you can write script using the Lua language by adding any component to your Schematic that has a
0:19
Lua editor. There are a couple of components that have this:
0:23
If you look in the Scripting Components branch, you’ll see the Control Script and the Scriptable
0:27
Controls component, both of which give you access to writing Lua. In newer versions of Q-SYS, you’ll
0:34
see the Text Controller component instead of Scriptable Controls, but they have nearly identical
0:39
functionality, so we’ll use them interchangeably in these videos.
0:43
The difference between these is that Control Script provides input and output control pins for you to
0:49
wire other components to your script, while the Scriptable Controls or Text Controller component
0:55
allows you to add customized controls embedded within the component, which will be a little easier
1:01
to reference internally.
1:02
We’ll look at creating these custom controls later, but for now let’s just do a tour of the scripting
1:08
window. For the Control Script, simply double click the component and instead of a control panel,
1:13
you’ll be taken to the script editing tab. This is the big black screen in which you can type in any script
1:19
you like, if you know what you’re doing.
1:22
From the Scriptable Controls component, you’ll need to click this “S” icon in order to access the script
1:27
editing tab. In the newer Text Controller, you can use the “Edit” button located in the same place.
1:34
Within the Script Editing Tab, there are a few areas to talk about, but first I’m going to enter
1:39
Emulation Mode. It’s important to note that your script will be functional in Emulation Mode. If
1:45
you’re sending commands to third-party devices or adjusting behavior of your design, this does not
1:50
require any audio processing so you don’t need to be running on an active Core.
1:55
Additionally, you can write your code in Emulation Mode or in Run Mode too. There’s no need to
2:00
return to Design mode to work on it, the way you do with the structure of your audio architecture.
2:06
As you type your script, you’ll notice a large yellow bar at the top that says Save Changes. Until you
2:13
press this button, the previous version of your script is still active and running. This lets you make
2:19
changes to the script on a live Core, but wait to deploy those changes until you’ve finished them.
2:26
At the bottom of the screen you’ll see the Debug Output window. If there are any errors in your
2:31
script, the Debug window will identify what that error is, and which line it occurs on.
2:37
You can see the line numbers for your script listed down the left side of the editing window. When
2:42
you start writing script, you may not always understand the errors the Debug window describe, but
2:48
hopefully it will at least point you in the right direction!
2:51
You’ll also notice that the top bar displays a list of the total errors in the script, as well as the current
2:58
load your script has on the available processing power. You can also find these determinations over in
3:03
the Design Inspector. Each scripting object that has errors will display as a red circle, while scripts that
3:10
have no errors will display as green circles.
3:14
Incidentally, you can also add Lua to a Block Controller, by going to the System category and dragging
3:20
in a Lua code block. If you just know you can script one particular thing faster than finding the blocks
3:27
for it, or if you need to write a script for something the Block controller can’t do but you still want to
3:32
integrate it with your other block programming, this block’s for you.
3:36
And once again, if you’re just jumping to this point in the control training videos, let’s remind you one
3:41
last time that if you are using any scripting objects then you will also need to deploy a Scripting
3:47
Engine Feature License on your Core before deploying.
3:52
In the next few videos we’ll talk about some basic tools you’ll need to write Lua script, and we’ll also
3:57
show you their equivalent concepts in the Block Controller and, if possible, the Control Components.
4:02
So move on whenever you’re ready.