DataScripts rely on the Lua scripting language for the syntax and supported usage of arithmetic, relational and logical operators. Operators compare or contrast datasets and will return true or false. When evaluating strings, DataScript is case-sensitive, so a does not equal A.
Arithmetic Operators
Operator |
Meaning |
---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
Relational Operators
Operator |
Meaning |
---|---|
> |
Greater than |
< |
Less than |
>= |
Greater than or equal to |
<= |
Less than or equal to |
== |
Equal to |
~= |
Not equal to |
If the port does not equal to 443, then redirect the client to HTTPS.
if avi.vs.port() ~= "443" then avi.http.redirect("https://" .. avi.http.hostname() .. avi.http.get_uri()) end
Logical Operators
Operator |
Definition |
---|---|
and |
Returns true if both datasets are true |
or |
Returns true if either of the datasets is true |
not |
Returns true of the first dataset is not true |
string.find |
Used to search for a string within another string |