Table of Contents

Expressions

TIScript supports following expressions:

Standard

// <expression> is instance of <class> 
// <expression> is *not* instance of <class> 
// pattern matching, see below. 
// pattern matching (inversion), see below. 
// result is a symbol - name of type of the expression. 
'('')''('')'// function call
'{''}'// function call with single parameter - object
'['']''['']'// slice of the string, array or index 
'#'// expr#some-symbol is a short form of expr[#some-symbol]
 

Slices

Slicing expression allows to create slice - fragment of sequential container. Currently only Array, String and Index support slicing.

// a1 will contain array [ 3,4,5 ] 
// a2 will contain array [ 3,4,5,6 ] 
// a3 will contain array [ 1,2,3 ] 
"tiscript"// s1 will contain "scr" 
// s2 will contain "script" 
// s3 will contain string "tis" 

expr#symbol form

TIScript supports special short form of get/set item by symbol operation -

<expression> <symbol-literal> 
Such form is an exact equivalent of
<expression> '[' <symbol-literal> ']'
Examples:
// non JS feature: get element by literal 
// true, standard access form
// short form of the line above
// true, short form
// true, note symbol literals can contain '-' inside
// In Sciter
 

like

Operator like tests its left side against pattern on the right side. Result of the expression is true if left side “looks like” pattern (pattern matches the string) or false - otherwise.

If pattern is a string then simple VB/VBA alike pattern syntax used:

Characters in pattern Matches in string
? Any single character.
* Zero or more characters.
# Any single digit (0–9).
[charlist] Any single character in charlist.
[^charlist] Any single character not in charlist.

Example:

"myimage.png""*.png"// true
"*.jpg"// false
"*.png"// false
"*.jpg"// true
"my*.png"// true
"my*.[a-zA-Z]ng"// true

This simple pattern matching is faster than regular expressions but can handle only simple pattern cases.

Function calls

There are two forms of function calls: normal function call and “object call”

normal call

Used when you need to pass zero or many parameters:

 

object call

Used when callee function accepts single parameter of type object:

 
The bar function shall accept single parameter of type object:
// will get value of param1
// will get value of param2