# Functions

Source: https://docs.formance.com/v4.0/modules/numscript/reference/functions

Stack: v4.0

Built-in functions callable from Numscript. Which functions you can use depends on the interpreter version bundled in your Ledger release — see [Selecting an Interpreter](https://docs.formance.com/v4.0/modules/numscript/interpreter) for the full availability matrix.

The entries below reflect your current selection: each experimental function shows whether it is available for the interpreter version you have selected.

## Statements

These are available on both the original (`machine`) and experimental interpreters.

### `set_tx_meta("key", value)`

Writes metadata to the transaction. The key is a string; the value can be any type, as a literal or a variable. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/metadata)

**Available from:** all versions (`machine` and `experimental-interpreter`).

### `set_account_meta(account, "key", value)`

Writes metadata to an account during the transaction. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/metadata)

**Available from:** all versions (`machine` and `experimental-interpreter`).

## Functions in `vars`

These functions are called when initializing variables in the `vars` block. Ledger 3.0 ships a single interpreter, so there is no `runtime` field to set; they still require the `experimental-mid-script-function-call` flag.

### `meta(account, "key")`

Reads structured account metadata into a typed variable. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/metadata)

**Available from:** interpreter `0.0.15` · Ledger 2.3 · Stack v3.1 · flag `experimental-mid-script-function-call`

Applies to: numscript=new.

Available in your selected version.

### `balance(account, asset)`

Returns the balance of an account for an asset. Fails on negative balances — use `overdraft()` for accounts that may go negative. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/mid-script-functions)

**Available from:** interpreter `0.0.15` · Ledger 2.3 · Stack v3.1 · flag `experimental-mid-script-function-call`

Applies to: numscript=new.

Available in your selected version.

### `overdraft(account, asset)`

Returns the positive overdraft amount of an account, or zero if the balance is non-negative. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/overdraft)

**Available from:** interpreter `0.0.15` · Ledger 2.3 · Stack v3.1 · flags `experimental-overdraft-function`, `experimental-mid-script-function-call`

Applies to: numscript=new.

Available in your selected version.

### `get_asset(monetary)`

Returns the asset part of a monetary value. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/get-asset)

**Available from:** interpreter `0.0.16` · Ledger 2.3 · Stack v3.1 · flag `experimental-get-asset-function`

Applies to: numscript=new.

Available in your selected version.

### `get_amount(monetary)`

Returns the numeric amount part of a monetary value. [Details](https://docs.formance.com/v4.0/modules/numscript/reference/get-amount)

**Available from:** interpreter `0.0.16` · Ledger 2.3 · Stack v3.1 · flag `experimental-get-amount-function`

Applies to: numscript=new.

Available in your selected version.
