DataScript: Operators

Operators compare or contrast sets of data, and will return as true or false.  DataScripts rely on the Lua scripting language for the syntax and supported usage of arithmetic, relational and logical operators.  DataScripts are case sensitive when evaluating strings, so “a” does not equal “A”.

 

Arithmetic Operators:

+                      -- Addition
-                      -- Subtraction
*                      -- Multiplication
/                      -- Division

 

Relational Operators:

>                     -- Greater than
<                     -- Less than
>=                    -- Greater than or equal
<=                    -- Less than or equal
==                    -- Equal
~=                    -- Not equal

If the port does not equal 443, then redirect the client to HTTPS.

if avi.vs.port() ~= "443" then
   avi.http.redirect("https://" .. avi.vs.host() .. avi.http.get_uri())
end

 

Logical Operators

and
or
not
string.find            -- Search for a string within another string.

 

Updated: 2018-01-17 11:31:43 +0000