Page 1 of 1

Difference between a script and an expression?

Posted: 18 Mar 2016 16:20
by Zacky_Momo
Hi there, I'm new to scripting and scripts and expressions look the same. What is the difference between these two?

Re: Difference between a script and an expression?

Posted: 18 Mar 2016 20:08
by Softcore
An "expression" is a variable Lemur constantly knows its value (roughly).

So an expression could be:

Code: Select all

k = 25
With scripts you can perform mathematical operations on those expressions, and then use the resulting numbers as a way to manipulate other objects of Lemur or the actual midi - OSC output.

Further down the line, you might meet expressions which are not defined in a fixed way like above but feature yet another mathematical expression.

For example in a Pad object you can create an expression w and set it so that:

Code: Select all

w = 1-x
The main difference then in "coding" expressions and scripts, is that expressions can only have a "one-line" script in them, while scripts can be multi-lines and more complex. Also expressions could be also thought of as "bonus" midi mappable outputs for the objects they are created in.

For example, now provided that x = 1 when a Pad is pressed, x = 0 when a Pad is released, then w will be the exact oposite of x so you could for example midi map that w expression and have a Pad send TWO values inverted, to switch on something in your mapped device - software and off something else at the same time.

Read cautiously the User Guide of Lemur and you will understand more.