A predefined function in TL-Script has a specific name which is globally known in all scripts. A predefined function is called directly by its name without assigning it to a variable first. All predefined functions are described in detail here and you get context help for the function when typing in an editor for TL-Script expressions.

For example, the length of a string can be determined using the function length (see Length). For predefined functions a number of special rules, when called

Normal function call

In a normal function call, all parameters are specified in the function parenthesis. If there are multiple parameters, the arguments are separated by commas.

length("Hello world!")
subString("Hello world!", 6, 11)

Chained function call

Function calls can be concatenated without having to nest the calls deeply. The first argument may be placed before the function name. In this notation, it is easy to build a chain of processing steps in which the result of the last processing step serves as input for the next step.

"Hello world!".substring(6, 11).length()

Especially with long processing chains the overview can be kept well in such a way, if each processing step is written into a new line:

"Hello world!"
    .substring(6, 11)
    .length()

Here, "Hello world!" first calculates the characters between the 6. and 11. ("world") and from this result determines the length (5).

Even without forming a chain, the first argument may always precede the function name, e.g., in:

"Hello world!".length()

This notation is equivalent to:

length("Hello world!")

Call with named arguments (as of 7.6.0).

Some functions with many parameters support the call with named arguments. The problem with the normal function call is that it is not easy to see at the call what the single argument means. So in subString("Hello world!", 6, 11) it is not clear what exactly 6 and 11 mean. Therefore you can name the passed arguments:

subString("Hello world!", from: 6, to: 11)

With this call form, you can omit any optional arguments. With a normal function call you may only omit arguments after the last specified argument.

subString("Hello world!", from: 6)

Here only the starting point is specified, the end is implicitly the end of the string. The result is "world!".

subString("Hello world!", to: 11)

Here the start point is omitted, which is implicitly the beginning of the string. The result is "Hello world".

In contrast, with normal calling, only optional arguments can be omitted at the end, since the position of the arguments defines their assignment to the function parameters. With normal function call in this case one can describe thus only sections starting from a certain character (substring("Hello world!", 6)) but not up to a certain character.

The call style can be mixed in one call. The first parameters can be specified by positional arguments and all others by named arguments. Thus, in the above example, the string from which the clipping is to be made is not named, but only the arguments defining the clipping positions. It is important to note that after the first named argument, all further arguments must also be named. For this reason, functions that support an arbitrary number of arguments (such as Convert to String) cannot be called with named arguments.