grandMA3 User Manual Publication

GetPath(string[, boolean] | integer)

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » GetPath(string[, boolean] | integer)
Version 2.0

Description

The GetPath Lua function returns a string with the path of a grandMA3 folder.

The function has two possible argument types - use one of them with each function call.

Argument

  • String:
    A text string with the folder name.
  • Boolean (optional with string):
    If this boolean is true, then the folder at the path is created if it does not exist.

    - OR -
     
  • Integer:
    An integer identifying an index in the "Enum.PathType" table.
Restriction:
Folder creation only works with string arguments.

Return

  • String:
    The returned string is the first found full path related to the provided argument.

Example

This example prints the paths of the show folder on the system monitor twice. It demonstrates the two different input types:

Lua
return function()
-- This prints a path based on a string input and it creates the folder if it does not exists.
Printf("Path of show files (string) is: " .. GetPath("shows", true))
-- This prints the path based on an integer. The integer is looked-up using the 'PathType' enum.
Printf("Path of show files (integer) is: " .. GetPath(Enums.PathType.Showfiles))
end