path

Module Functions

path.basename(filename)

Returns everything behind the last /.

Parameters

filename (class:string) – filename to return basename for.

Returns

The basename.

path.dirname(filename)

Everything before the final / in filename. The returned value is either the empty string or ends with a ‘/’.

Parameters

filename (class:string) – filename to return dirname for.

Returns

The dirname.

path.list_files(filename_template)

DEPRECATED. Lists the full path for all files that fit the template pattern. Use ? as placeholders for numbers, e.g. ‘directory/idle_??.png’ will list ‘directory/idle_00.png’, ‘directory/idle_01.png’ etc, and ‘directory/idle.png’ will just list ‘directory/idle.png’. Lua Tables need lots of memory, so only use this when you have to.

Parameters

filename_template (class:string) – The filename template to use for the listing.

Returns

An array of file paths in lexicographical order.

path.list_directory(filename)

Returns all file names contained in the given directory. Lua Tables need lots of memory, so only use this when you have to.

Parameters

filename (class:string) – The directory to read.

Returns

An array of file names.

path.is_directory(filename)

Checks whether the given filename points to a directory.

Parameters

filename (class:string) – The filename to check.

Returns

true if the given path is a directory.

path.file_exists(filename)

Checks whether the given filename points to a file or directory.

Parameters

filename (class:string) – The filename to check.

Returns

true if the given path is a file or directory.