What language should I be using for the expression editor?

Content Creation Editions Composer

 

I understand that the Scripting system uses Lua but I'm not sure exactly what formatting and features are possible to use with the expression editor.

Can it do any logic or is it limited to calculations? What operations are possible within it?

   mrlargefoot

 
Profile Image
Zoltan@Aximmetry
7/24/2021 11:10:03 AM
  -  

Hi,

It is only for calculations, however you have the if function and the logical operations to do some logic.

All operations can be applied both on scalars and vectors of any elements.


Arithmetic operators

-a

a + b

a - b

a * b

a / b

a % b  (modulo)

a ^ b  (power)


Logical operators

!a

a | b

a & b


Relational operators

a = b

a != b

a < b

a <= b

a > b

a >= b


Arithmetic functions

abs(a)

acos(a)

atan(a)

asin(a)

avg(a, b)  (average)

ceil(a)

clamp(x, a, b)

cos(a)

exp(a)

floor(a)

inv(a)  (invert, 1 - a)

lerp(a, b, x)

log(a)

max(a, b)

min(a, b)

mod(a, b)  (modulo)

modb(a, b, base)  (modulo with base)

rec(a)  (reciprocal, 1 / a)

round(a)

sin(a)

sqr(a)

sqrt(a)

tan(a)

unlerp(x, a, b)


Logical functions

if(x, a, b)  (if x then a else b)

xor(a, b)

bit(a, x)  (test the xth bit)


Vector functions

cross(a, b)

dot(a, b)

len(a)

norm(a)  (normalize)

concat(a, b)

dim(a)  (dimension, number of elements in a)

fill(v, n)  (create a vector with n elements filled with value v)

insert(a, i, b)  (insert elements of b into a at index i)

item(a, s, i)  (get ith element of size s from a)

slice(a, s, i, n)  (get n elements of size s from start index i from a)