Functions

## Index for Nift's hard-coded functions

#### Introduction

Nift has its own poweful in-built template language n++ which you can use in amongst any other scripting, programming and/or template language you want. It also has its own in-built scripting language f++ which also works well in interactive shell mode as a shell extension. This page is an index for all the functions available with the template language n++ and scripting/shell extension language f++.

#### Syntax

The syntax for Nift function calls is as follows:

f++:
funcName{options}(params)


n++:
@funcName{options}(params)


You can use Nift's template language with the function name, options and parameters for a function call. For example:

@input("$[contentpath]") You can even expand multiple options or parameters when parsing the options or parameters string with both f++ and n++. A contrived n++ example that is equivalent to calling @funcName(param 1, param2) is below: @string str = "param 1, param 2" @funcName($[str])


Note: you need to quote the function name when doing things like printing variables or calling functions in the function name. A contrived n++ example is below:

@string str = "input"
@"$[str]"("$[contentpath]")


Nift is pretty good at working out when it does or does not need to parse things like the function name, options and/or parameters. You can manually tell Nift to not parse the function name and parameters using the !p option. For example:

@input("@{!p}[contentpath]")


Note: For options and parameters (including variable names and values), you can use:

• \n for the newline character
• \t for tabs (though normal tabs also work)
• \\ for \
• \' for '
• \" for "

Function names, options and parameters (including variable names and values) can be unquoted, single quoted or double quoted, whichever is more convenient, integrates with the other programming, scripting and/or template languages you are using and/or has nice syntax highlighting with the extensions and editor(s) you are using. Also for functions that can take multiple parameters, parameters containing commas ',' should be quoted, there can also be other times that things need to be quoted, for example if you want to have equals '=' in a variable name during its definition then it will need to be quoted (though will not need to be quoted when referenced).

#### Options

The following options are available for almost all function calls:

option description
!p do not parse parameters
v replace variables with their values (where applicable)
!v do not replace variables with their values (where applicable)
1p treat parameter string as one parameter
option description

The following options are available for user-defined function calls:

option description
mf add member functions for options and params vectors
!mf do not add member functions for options and params vectors
option description

[index]

#### Index

Below is an index of Nift's hard-coded functions (including functions for defining variables, functions and structures/types) which can be called from f++ and n++: