Skip to main content

Utility

Constants

colored_output

colored_output: bool

Controls if terminal output is colored or not.

edit_instrument

edit_instrument: integer | nil

Index of the currently edited instrument.

script_executed_from_instrument

script_executed_from_instrument: integer | nil

Index of the instrument slot from which the script was loaded. nil is multi.

script_file

script_file: string

Returns filename of the currently running Lua script, including the extension.

script_path

script_path: string

Returns the absolute path to the folder containing the currently running Lua script.

version

version: string

Returns the current version of the running instance of Kontakt.

Functions

assert_fail

assert_fail(test: function)

Unit test helper function. Calls test expecting it to fail. Raises an error if that does not happen.

create_resource_container

create_resource_container(instrument_idx: integer, filename: string)

Creates a new resource container (with the obligatory Resources folder) or updates an existing resource container. If the .nkr extension is not a part of the filename string, it will be added automatically.

get_file_info

get_file_info(filename: string) -> table

Extracts information from an instrument on disk. The returned table contains the fields: file, format, version, library, num_instruments, num_groups, num_zones.

instrument_purge

instrument_purge(instrument_idx: integer, mode: string)

Runs one of available purge actions for the specified instrument. See instrument_purge_modes.

File I/O

ncw_decode

ncw_decode(source: string, target: string)

Decodes an NCW sample back to uncompressed WAV format.

ncw_encode

ncw_encode(source: string, target: string)

Encodes a WAV or AIFF sample to losslessly compressed NCW format.