fn: exprtk
[contents]

Contents

Syntax

The syntax for exprtk calls is:

f++:  
$`expression`
exprtk{options}(expression)
exprtk{f, options}(file-path)
exprtk{options}
{
	//block of ExprTk code
}

n++:  
$`expression`
@exprtk{options}(expression)
@exprtk{f, options}(file-path)
@exprtk{options}
{
	//block of ExprTk code
}

Description

The exprtk function is for compiling and evaluating ExprTk expressions, it takes zero parameters with the call followed by a block of ExprTk code to compile and evaluate otherwise a single parameter that should be a file-path to ExprTk code to compile and run (you need to specify the option to use a file). See here for more information about ExprTk.

Note: The preceding $ has only been added since v2.3.13, primarily so that functionstein works better as an extension language, in particular with FLASHELL working as a shell extension.

Options

The following options are available for exprtk calls:

option description
f/file param specifies file-path
f++ use f++ if parsing block
n++ use n++ if parsing block
!o do not return output
o return output
pb parse block with language call is made from before compiling and evaluating with ExprTk
!round do not round value of ExprTk expression
option description

f++ example

Examples of exprtk being used with f++:

$`var x:=0; nsm_write(console, x, endl)`
exprtk
{
	var x:=0; 
	nsm_write(console, x, endl);
}
exprtk("./path.exptk")
exprtk.add_package(basicio_package)
exprtk
{
	for(var i:=0; i<10; i+=1)
	{
		println('i: ', i);
	}
}
int x = $`2^2 + 3*8 + 4`
console(x)

n++ example

Example of exprtk being used with n++:

$`var x:=0; nsm_write(console, x, endl)`
@exprtk
{
	var x:=0; 
	nsm_write(console, x, endl);
}
@exprtk("./path.exprtk")
@exprtk.add_package(basicio_package)
@exprtk
{
	for(var i:=0; i<10; i+=1)
	{
		println('i: ', i);
	}
}
@int(x = $`2^2 + 3*8 + 4`)
@console(x)