Syntax
The syntax for expressions is inspired by JavaScript. While it resembles JavaScript in many ways, it is not a full implementation of the language. Instead, it is a minimalistic subset specifically tailored for defining expressions in this context.
This approach ensures simplicity and ease of use while maintaining the flexibility needed for powerful expressions. Users familiar with JavaScript will find the syntax intuitive, but it's important to note that certain JavaScript features may not be available.
Data types
variables
variable name
string
"hello”
or 'hello’
number
89
6.45
integer float
boolean
true false
template string
text
${}
text
Everything is interpreted as a string, except what is inside ${}
it is an embedded expression
Use this to utilize variables and expressions for a Text element (Floating UI) or 3D text.
datasets
IDENTIFIER[SELECTOR]
Datasets are referenced using the syntax: IDENTIFIER[SELECTOR]
Data
[
"A1"
]
Multidimensional selection is supported for rows and columns:
Data
[
0
][
1
]
unary expressions
minus -
negation
!
Supported data structures
Our expression language supports the following data structures:
Arrays
Arrays can contain elements of mixed types, for example:
[1, 2, "A", "B", true]
Colors and vectors are represented as arrays:
[1, 0, 0]
represents the color RGB(255, 0, 0)[5, 10, 3]
represents a 3D vector, Vector3(5, 10, 3)
Objects or classes are not used; only arrays are employed to maintain simplicity
Array Indexing
Elements within an array can be accessed using zero-based indexing:
Example:
[1, 2, 3, 4, 5, 6][0]
evaluates to1
Syntax:
[array content][index]
Binary operators
add
+
subtract
-
multiply
*
divide
/
equals
==
5
==
6
(false)
not equals
!=
5
!=
6
(true)
less than
<
more than
>
less than or equal to
<=
more than or equal to
=>
AND
&&
OR
||
nullish coalescing
??
negation
!
mod
%
range
:
Tips
Spaces are ignored — spaces are ignored in expressions unless they are inside a string or template string.
Variable name as text — typing quotation marks before and after a variable name treats it as regular text rather than referencing the variable.
Variable name in the expression — referencing a variable name in an expression calculates its value like any other number if the variable is of type number. if the value of the variable is 10, than typing position + 100 will output result of 110
Colors in UI
Regular text or number
Black
Variables
Purple
Functions, true/false
Blue
Operators
Teal
Invalid/incorrect value
Red
Expression
Yellow
String
Green
Last updated