diff --git a/content/_index.html b/content/_index.html index ae91bb9..a64d10b 100644 --- a/content/_index.html +++ b/content/_index.html @@ -1,6 +1,17 @@ --- title: Home -id: lua-documentation +id: darktable Lua documentation draft: false author: "people" --- + +

+ +

+darktable is an open source photography workflow application and raw developer — a virtual lighttable and darkroom for photographers. It manages your digital negatives in a database, lets you view them through a zoomable lighttable and enables you to develop and enhance your raw images. +

+

+darktable contains an embedded interpreter for the Lua programming language which provides the ability to modify and extend darktable's functionality. This documentation set contains descriptions of the extensions and Application Program Interface (API). +

+The source repository for this documentation may be found at https://github.com/darktable-org/luadocs.git. Any feedback relating to this documentation can be provided by creating a ticket or a pull request against this repository. +

diff --git a/content/images/darktable-logo.png b/content/images/darktable-logo.png new file mode 100644 index 0000000..3df6449 Binary files /dev/null and b/content/images/darktable-logo.png differ diff --git a/content/lua.api/_index.html b/content/lua.api/_index.html new file mode 100644 index 0000000..610cbd0 --- /dev/null +++ b/content/lua.api/_index.html @@ -0,0 +1,11 @@ +--- +title: Lua API Manual +id: Lua Scripts Manual +weight: 30 +draft: false +author: "people" +--- + +

+The Lua API manual is currently being converted. +

\ No newline at end of file diff --git a/content/lua.scripts.api.manual/_index.html b/content/lua.scripts.api.manual/_index.html new file mode 100644 index 0000000..bff9aa5 --- /dev/null +++ b/content/lua.scripts.api.manual/_index.html @@ -0,0 +1,10 @@ +--- +title: Lua Scripts Libraries API Manual +id: Lua Scripts API Manual +weight: 20 +draft: false +author: "people" +--- + +

+ diff --git a/content/lua.scripts.api.manual/dtutils.debug/_index.md b/content/lua.scripts.api.manual/dtutils.debug/_index.md new file mode 100644 index 0000000..e10372e --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils.debug +id: dtutils-debug +weight: 20 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils.debug/details.md b/content/lua.scripts.api.manual/dtutils.debug/details.md new file mode 100644 index 0000000..79dbd45 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/details.md @@ -0,0 +1,59 @@ +--- +title: details +id: details +weight: 10 +draft: false +author: "people" +--- + +## NAME + +dtutils.debug + +## SYNOPSIS + +debugging helpers used in developing darktable lua scripts + +## USAGE +``` +require "lib/dtutils.debug" +``` +## DESCRIPTION + +dtutils.debug provides an interface to the darktable debugging routines. + +## RETURN VALUE + +**dd** - _library_ - the darktable lua debugging helpers + +## FUNCTIONS + +### [dprint](dprint.md) + +pass a variable to darktable.debug.dump and print the results to stdout + +### [new_tracepoint](new_tracepoint.md) + +create a function returning a tracepoint + +### [terse_dump](terse_dump.md) + +set darktable.debug.known to shorten all image dumps to a single line + +### [tracepoint](tracepoint.md) + +print out a tracepoint and dump the arguments + +## LICENSE + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . + diff --git a/content/lua.scripts.api.manual/dtutils.debug/dprint.md b/content/lua.scripts.api.manual/dtutils.debug/dprint.md new file mode 100644 index 0000000..1bdd309 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/dprint.md @@ -0,0 +1,27 @@ +--- +title: dprint +id: dprint +weight: 20 +draft: false +author: "people" +--- + +## NAME + +dprint + +## SYNOPSIS + +pass a variable to darktable.debug.dump and print the results to stdout + +## USAGE +``` +local dd = require "lib/dtutils.debug" +dd.dprint(var) +``` +**var** - _variable_ - any variable that you want to see the contents of + +## DESCRIPTION + +**dprint** is a wrapper around **darktable.debug.dump**, will directly print to stdout, +same calling convention diff --git a/content/lua.scripts.api.manual/dtutils.debug/new_tracepoint.md b/content/lua.scripts.api.manual/dtutils.debug/new_tracepoint.md new file mode 100644 index 0000000..ef401f9 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/new_tracepoint.md @@ -0,0 +1,42 @@ +--- +title: new_tracepoint +id: new-tracepoint +weight: 30 +draft: false +author: "people" +--- + +## NAME + +new_tracepoint + +## SYNOPSIS + +create a function returning a tracepoint + +## USAGE +``` +local dd = require "lib/dtutils.debug" +local result = dd.new_tracepoint(name, ...) +``` +**name** - _string_ - the name of the tracepoint to print out +**...** - _arguments_ - variables to dump the contents of + +## DESCRIPTION + +**new_tracepoint** returns a tracepoint function with the given name. +This is mainly used to debug callbacks. + +## RETURN VALUE + +**result** - _function_ - a function that returns the result of a tracepoint + +## EXAMPLE +``` +register_event(event, dd.new_tracepoint("hit callback")) +``` +will print the following each time the callback is called +``` +**** hit callback **** + +``` diff --git a/content/lua.scripts.api.manual/dtutils.debug/terse_dump.md b/content/lua.scripts.api.manual/dtutils.debug/terse_dump.md new file mode 100644 index 0000000..50d57b6 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/terse_dump.md @@ -0,0 +1,25 @@ +--- +title: terse_dump +id: terse-dump +weight: 40 +draft: false +author: "people" +--- + +## NAME + +terse_dump + +## SYNOPSIS + +set darktable.debug.known to shorten all image dumps to a single line + +## USAGE +``` +local dd = require "lib/dtutils.debug" +dd.terse_dump() +``` +## DESCRIPTION + +**terse_dump** sets **darktable.debug.known** to shorten all images to a single line. +If you don't need to debug the content of images, this will avoid them flooding your logs. diff --git a/content/lua.scripts.api.manual/dtutils.debug/tracepoint.md b/content/lua.scripts.api.manual/dtutils.debug/tracepoint.md new file mode 100644 index 0000000..e3da177 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.debug/tracepoint.md @@ -0,0 +1,32 @@ +--- +title: tracepoint +id: tracepoint +weight: 50 +draft: false +author: "people" +--- + +## NAME + +tracepoint + +## SYNOPSIS + +print out a tracepoint and dump the arguments + +## USAGE +``` +local dd = require "lib/dtutils.debug" +local result = dd.tracepoint(name, ...) +``` +**name** - _string_ - the name of the tracepoint to print out +**...** - _arguments_ - variables to dump the contents of + +## DESCRIPTION + +**tracepoint** prints its name and dumps its parameters using +**darktable.debug**. + +## RETURN VALUE + +**result** - _..._ - the supplied argument list diff --git a/content/lua.scripts.api.manual/dtutils.file/_index.md b/content/lua.scripts.api.manual/dtutils.file/_index.md new file mode 100644 index 0000000..cafb036 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils.file +id: dtutils-file +weight: 30 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils.file/check_if_bin_exists.md b/content/lua.scripts.api.manual/dtutils.file/check_if_bin_exists.md new file mode 100644 index 0000000..f4f6e57 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/check_if_bin_exists.md @@ -0,0 +1,35 @@ +--- +title: check_if_bin_exists +id: check_if_bin_exists +weight: 20 +draft: false +author: "people" +--- + +## NAME + +check_if_bin_exists + +## SYNOPSIS + +check if an executable exists + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.check_if_bin_exists(bin) +``` +**bin** - _string_ - the binary to check for + +## DESCRIPTION + +**check_if_bin_exists** checks to see if the specified binary exists. +**check_if_bin_exists** first checks to see if a preference for the binary has been +registered and uses that if found. The presence of the file is verified, then +quoted and returned. If no preference is specified and the operating system is +linux then the which command is used to check for a binary in the path. If found +that path is returned. If no binary is found, false is returned. + +## RETURN VALUE + +**result** - _string_ - the sanitized path of the binary, false if not found diff --git a/content/lua.scripts.api.manual/dtutils.file/check_if_file_exists.md b/content/lua.scripts.api.manual/dtutils.file/check_if_file_exists.md new file mode 100644 index 0000000..2ba95bf --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/check_if_file_exists.md @@ -0,0 +1,30 @@ +--- +title: check_if_file_exists +id: check_if_file_exists +weight: 30 +draft: false +author: "people" +--- + +## NAME + +check_if_file_exists + +## SYNOPSIS + +check if a file or path exist + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.check_if_file_exists(filepath) +``` +**filepath** - _string_ - a file or path to check + +## DESCRIPTION + +**check_if_file_exists** checks to see if a file or path exists. + +## RETURN VALUE + +**result** - _boolean_ - true if the file or path exists, false if it doesn't. diff --git a/content/lua.scripts.api.manual/dtutils.file/chop_filetype.md b/content/lua.scripts.api.manual/dtutils.file/chop_filetype.md new file mode 100644 index 0000000..0ffef43 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/chop_filetype.md @@ -0,0 +1,30 @@ +--- +title: chop_filetype +id: chop_filetype +weight: 40 +draft: false +author: "people" +--- + +## NAME + +chop_filetype + +## SYNOPSIS + +remove a filetype from a filename + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.chop_filetype(path) +``` +**path** - _string_ - a filename with or without a path + +## DESCRIPTION + +**chop_filetype** removes the filetype from the filename. + +## RETURN VALUE + +**result** - _string_ - the path and filename without the filetype diff --git a/content/lua.scripts.api.manual/dtutils.file/create_unique_filename.md b/content/lua.scripts.api.manual/dtutils.file/create_unique_filename.md new file mode 100644 index 0000000..c4a4207 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/create_unique_filename.md @@ -0,0 +1,37 @@ +--- +title: create_unique_filename +id: create_unique_filename +weight: 50 +draft: false +author: "people" +--- + +## NAME + +create_unique_filename + +## SYNOPSIS + +create a unique filename from the supplied argument + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.create_unique_filename(filepath) +``` +**filepath** - _string_ - the path and filename requested + +## DESCRIPTION + +**create_unique_filename** takes a requested filepath and checks to see if +it exists. If if doesn't then it's returned intact. If it already exists, then a two +digit increment is added to the filename and it is tested again. The increment keeps +increasing until either a unique filename is found or there have been 100 attempts. + +## RETURN VALUE + +**result** - _string_ - the incremented filename + +## LIMITATIONS + +**create_unique_filename** will only attempt 100 increments. diff --git a/content/lua.scripts.api.manual/dtutils.file/details.md b/content/lua.scripts.api.manual/dtutils.file/details.md new file mode 100644 index 0000000..e53e727 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/details.md @@ -0,0 +1,116 @@ +--- +title: details +id: details +weight: 10 +draft: false +author: "people" +--- + +## NAME + +details + +## SYNOPSIS + +common darktable lua file functions + +## USAGE +``` +local df = require "lib/dtutils.file" +``` +## DESCRIPTION + +The **dtutils.file** library provides common file manipulation functions used in +constructing darktable lua scripts + +## RETURN VALUE + +**df** - _library_ - the file functions + +## FUNCTIONS + +### [check_if_bin_exists](check_if_bin_exists.md) + +check if an executable exists + +### [check_if_file_exists](check_if_file_exists.md) + +check if a file or path exist + +### [chop_filetype](chop_filetype.md) + +remove a filetype from a filename + +### [create_unique_filename](create_unique_filename.md) + +create a unique filename from the supplied argment + +### [executable_path_widget](executable_path_widget.md) + +create a widget to get executable path preferences + +### [file_copy](file_copy.md) + +copy a file to another name/location + +### [file_move](file_move.md) + +move a file from one directory to another + +### [filename_increment](filename_increment.md) + +add a two digit increment to a filename + +### [get_basename](get_basename.md) + +get the filename without the path or extension + +### [get_executable_path_preference](get_executable_path_preference.md) + +return the path to an executable from a preference + +### [get_filename](get_filename.md) + +get the filename and extension from a file path + +### [get_filetype](get_filetype.md) + +get the filetype from a filename + +### [get_path](get_path.md) + +get the path from a file path + +### [mkdir](mkdir.md) + +create the directory(ies) if they do not already exists + +### [rmdir](rmdir.md) + +recursively remove a directory + +### [sanitize_filename](sanitize_filename.md) + +make a filename safe to pass as an argument + +### [set_executable_path_preference](set_executable_path_preference.md) + +set a preference for the path to an executable + +### [split_filepath](split_filepath.md) + +split a filepath into parts + +## LICENSE + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . + diff --git a/content/lua.scripts.api.manual/dtutils.file/executable_path_widget.md b/content/lua.scripts.api.manual/dtutils.file/executable_path_widget.md new file mode 100644 index 0000000..782d424 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/executable_path_widget.md @@ -0,0 +1,33 @@ +--- +title: executable_path_widget +id: executable_path_widget +weight: 60 +draft: false +author: "people" +--- + +## NAME + +executable_path_widget + +## SYNOPSIS + +create a widget to get executable path preferences + +## USAGE +``` +local df = require "lib/dtutils.file" +local widget = df.executable_path_widget(executables) +``` +**executables** - _table_ - a table of strings that are executable names + +## DESCRIPTION + +**executable_path_widget** takes a table of executable names +and builds a set of file selector widgets to get the path to the executable. +The resulting widgets are wrapped in a box widget and returned. + +## RETURN VALUE + +**widget** - _widget_ - a widget containing a file selector widget for +each executable. diff --git a/content/lua.scripts.api.manual/dtutils.file/file_copy.md b/content/lua.scripts.api.manual/dtutils.file/file_copy.md new file mode 100644 index 0000000..a302750 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/file_copy.md @@ -0,0 +1,32 @@ +--- +title: file_copy +id: file_copy +weight: 70 +draft: false +author: "people" +--- + +## NAME + +file_copy + +## SYNOPSIS + +copy a file to another name/location + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.file_copy(fromFile, toFile) +``` +**fromFile** - _string_ - name of file to copy from +**toFile** - _string_ - name of file to copy to + +## DESCRIPTION + +copy a file using a succession of methods from operating system +to a pure lua solution + +## RETURN VALUE + +**result** - _boolean_ - nil on error, true on success diff --git a/content/lua.scripts.api.manual/dtutils.file/file_move.md b/content/lua.scripts.api.manual/dtutils.file/file_move.md new file mode 100644 index 0000000..ae6f8ed --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/file_move.md @@ -0,0 +1,32 @@ +--- +title: file_move +id: file_move +weight: 80 +draft: false +author: "people" +--- + +## NAME + +file_move + +## SYNOPSIS + +move a file from one directory to another + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.file_move(fromFile, toFile) +``` +**fromFile** - _string_ - name of the original file +**toFile** - _string_ - the new file location and name + +## DESCRIPTION + +Move a file from one place to another. Try a succession of methods from +builtin to operating system to a pure lua solution. + +## RETURN VALUE + +**result** - _boolean_ - nil on error, some value on success diff --git a/content/lua.scripts.api.manual/dtutils.file/filename_increment.md b/content/lua.scripts.api.manual/dtutils.file/filename_increment.md new file mode 100644 index 0000000..7d7e02f --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/filename_increment.md @@ -0,0 +1,37 @@ +--- +title: filename_increment +id: filename_increment +weight: 90 +draft: false +author: "people" +--- + +## NAME + +filename_increment + +## SYNOPSIS + +add a two digit increment to a filename + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.filename_increment(filepath) +``` +**filepath** - _string_ - filename to increment + +## DESCRIPTION + +**filename_increment** solves the problem of filename conflict by adding an +increment to the filename. If the supplied filename has no increment then +"01" is added to the basename. If the filename already has an increment, then +1 is added to it and the filename returned. + +## RETURN VALUE + +**result** - _string_ - the incremented filename + +## LIMITATIONS + +The filename will be incremented to a maximum of 99. diff --git a/content/lua.scripts.api.manual/dtutils.file/get_basename.md b/content/lua.scripts.api.manual/dtutils.file/get_basename.md new file mode 100644 index 0000000..136f405 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/get_basename.md @@ -0,0 +1,30 @@ +--- +title: get_basename +id: get_basename +weight: 100 +draft: false +author: "people" +--- + +## NAME + +get_basename + +## SYNOPSIS + +get the filename without the path or extension + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.get_basename(filepath) +``` +**filepath** - _string_ - path and filename + +## DESCRIPTION + +**get_basename** returns the name of the file without the path or filetype. + +## RETURN VALUE + +**result** - _string_ - the basename of the file diff --git a/content/lua.scripts.api.manual/dtutils.file/get_executable_path_preference.md b/content/lua.scripts.api.manual/dtutils.file/get_executable_path_preference.md new file mode 100644 index 0000000..248ae79 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/get_executable_path_preference.md @@ -0,0 +1,35 @@ +--- +title: get_executable_path_preference +id: get_executable_path_preference +weight: 110 +draft: false +author: "people" +--- + +## NAME + +get_executable_path_preference + +## SYNOPSIS + +return the path to an executable from a preference + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.get_executable_path_preference(executable) +``` +**executable** - _string_ - the name of the executable to get the path for + +## DESCRIPTION + +**get_executable_path_preference** returns the path preference to +the requested executable. + +## RETURN VALUE + +**result** - _string_ - path to the executable + +## LIMITATIONS + +executable should be the basename of the executable without extensions diff --git a/content/lua.scripts.api.manual/dtutils.file/get_filename.md b/content/lua.scripts.api.manual/dtutils.file/get_filename.md new file mode 100644 index 0000000..8a8e713 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/get_filename.md @@ -0,0 +1,30 @@ +--- +title: get_filename +id: get_filename +weight: 120 +draft: false +author: "people" +--- + +## NAME + +get_filename + +## SYNOPSIS + +get the filename and extension from a file path + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.get_filename(filepath) +``` +**filepath** - _string_ - path and filename + +## DESCRIPTION + +**get_filename** strips the path from a filepath and returns the filename + +## RETURN VALUE + +**result** - _string_ - the file name and type diff --git a/content/lua.scripts.api.manual/dtutils.file/get_filetype.md b/content/lua.scripts.api.manual/dtutils.file/get_filetype.md new file mode 100644 index 0000000..2692e09 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/get_filetype.md @@ -0,0 +1,30 @@ +--- +title: get_filetype +id: get_filetype +weight: 130 +draft: false +author: "people" +--- + +## NAME + +get_filetype + +## SYNOPSIS + +get the filetype from a filename + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.get_filetype(filepath) +``` +**filepath** - _string_ - path and filename + +## DESCRIPTION + +**get_filetype** returns the filetype from the supplied filepath + +## RETURN VALUE + +**result** - _string_ - the filetype diff --git a/content/lua.scripts.api.manual/dtutils.file/get_path.md b/content/lua.scripts.api.manual/dtutils.file/get_path.md new file mode 100644 index 0000000..3243c22 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/get_path.md @@ -0,0 +1,30 @@ +--- +title: get_path +id: get_path +weight: 140 +draft: false +author: "people" +--- + +## NAME + +get_path + +## SYNOPSIS + +get the path from a file path + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.get_path(filepath) +``` +**filepath** - _string_ - path and filename + +## DESCRIPTION + +**get_path** strips the filename and filetype from a path and returns the path + +## RETURN VALUE + +**result** - _string_ - the path diff --git a/content/lua.scripts.api.manual/dtutils.file/mkdir.md b/content/lua.scripts.api.manual/dtutils.file/mkdir.md new file mode 100644 index 0000000..993816c --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/mkdir.md @@ -0,0 +1,31 @@ +--- +title: mkdir +id: mkdir +weight: 150 +draft: false +author: "people" +--- + +## NAME + +mkdir + +## SYNOPSIS + +create the directory(ies) if they do not already exist + +## USAGE +``` +local df = require "lib/dtutils.file" +df.mkdir(path) +``` +**path** - _string_ - a directory path + +## DESCRIPTION + +**mkdir** creates directories if they do not already exist. It +creates parent directories if needed. + +## RETURN VALUE + +_**path** - string_ - a directory path diff --git a/content/lua.scripts.api.manual/dtutils.file/rmdir.md b/content/lua.scripts.api.manual/dtutils.file/rmdir.md new file mode 100644 index 0000000..6d36a87 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/rmdir.md @@ -0,0 +1,30 @@ +--- +title: rmdir +id: rmdir +weight: 160 +draft: false +author: "people" +--- + +## NAME + +rmdir + +## SYNOPSIS + +recursively remove a directory + +## USAGE +``` +local df = require "lib/dtutils.file" +df.rmdir(path) +``` +**path** - _string_ - a directory path + +## DESCRIPTION + +**rmdir** allows directories to be removed recursively. + +## RETURN VALUE + +**path** - _string_ - a directory path diff --git a/content/lua.scripts.api.manual/dtutils.file/sanitize_filename.md b/content/lua.scripts.api.manual/dtutils.file/sanitize_filename.md new file mode 100644 index 0000000..f15917d --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/sanitize_filename.md @@ -0,0 +1,32 @@ +--- +title: sanitize_filename +id: sanitize_filename +weight: 170 +draft: false +author: "people" +--- + +## NAME + +sanitize_filename + +## SYNOPSIS + +make a filename safe to pass as an argument + +## USAGE +``` +local df = require "lib/dtutils.file" +local sanitized_filename = df.sanitize_filename(filename) +``` +**filename** - _string_ - a filepath and filename + +## DESCRIPTION + +**sanitize_filename** places quotes around the filename in an +operating system specific manner. The result is safe to pass as +an argument to the operating system. + +## RETURN VALUE + +**sanitized_filename** - _string_ - quoted filename diff --git a/content/lua.scripts.api.manual/dtutils.file/set_executable_path_preference.md b/content/lua.scripts.api.manual/dtutils.file/set_executable_path_preference.md new file mode 100644 index 0000000..9bffd28 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/set_executable_path_preference.md @@ -0,0 +1,28 @@ +--- +title: set_executable_path_preference +id: set_executable_path_preference +weight: 180 +draft: false +author: "people" +--- + +## NAME + +set_executable_path_preference + +## SYNOPSIS + +set a preference for the path to an executable + +## USAGE +``` +local df = require "lib/dtutils.file" +df.set_executable_path_preference(executable, path) +``` +**executable** - _string_ - the name of the executable to set the path for +**path** - _string_ - the path to the binary + +## DESCRIPTION + +**set_executable_path_preference** takes an executable name and path to the +executable and registers the preference for later use. diff --git a/content/lua.scripts.api.manual/dtutils.file/split_filepath.md b/content/lua.scripts.api.manual/dtutils.file/split_filepath.md new file mode 100644 index 0000000..fc5cf83 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.file/split_filepath.md @@ -0,0 +1,31 @@ +--- +title: split_filepath +id: split_filepath +weight: 190 +draft: false +author: "people" +--- + +## NAME + +split_filepath + +## SYNOPSIS + +split a filepath into parts + +## USAGE +``` +local df = require "lib/dtutils.file" +local result = df.split_filepath(filepath) +``` +**filepath** - _string_ - path and filename + +## DESCRIPTION + +**split_filepath** splits a filepath into the path, filename, basename and filetype and puts +that in a table + +## RETURN VALUE + +**result** - _table_ - a table containing the path, filename, basename, and filetype diff --git a/content/lua.scripts.api.manual/dtutils.log/_index.md b/content/lua.scripts.api.manual/dtutils.log/_index.md new file mode 100644 index 0000000..3616fb2 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils.log +id: dtutils-log +weight: 40 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils.log/caller.md b/content/lua.scripts.api.manual/dtutils.log/caller.md new file mode 100644 index 0000000..c7cd7db --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/caller.md @@ -0,0 +1,30 @@ +--- +title: caller +id: caller +weight: 20 +draft: false +author: "people" +--- + +## NAME + +caller + +## SYNOPSIS + +get the name and line number of the calling routine + +## USAGE +``` +local log = require "lib/dtutils.log" +result = log.caller(level) +``` +**level** - _number_ - the number of stack levels to go down to retrieve the caller routine information + +## DESCRIPTION + +**caller** gets the name and line number of the calling routine and returns it + +## RETURN VALUE + +**result** - _string_ - the name and line number of the calling function or 'callback: ' if the attempt to get the caller returns nil diff --git a/content/lua.scripts.api.manual/dtutils.log/details.md b/content/lua.scripts.api.manual/dtutils.log/details.md new file mode 100644 index 0000000..c764d75 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/details.md @@ -0,0 +1,80 @@ +--- +title: details +id: details +weight: 10 +draft: false +author: "people" +--- + +## NAME + +dtutils.log + +## SYNOPSIS + +darktable lua logging library + +## USAGE +``` +local log = require "lib/dtutils.log" +``` +## DESCRIPTION + +**log** provides a multi-level logging solution for use with +the darktable lua scripts. With this library you can leave log messages +scattered through out your code and only turn them on as necessary. + +## RETURN VALUE + +**log** - _library_ - the darktable lua logging functions + +## FUNCTIONS + +### [caller](caller.md) + +get the name and line number of the calling routine + +### [engine](engine.md) + +get and set the output engine + +### [log_level](log_level.md) + +get or set the log level + +### [msg](msg.md) + +print a log message + +## EXAMPLE +``` +local log = require "lib/dtutils.log" +local cur_level = log.log_level() +log.log_level(log.warn) +``` +print out warning, error and success messages as code is running +``` +log.log_level(debug) +``` +print out debugging messages too because this isnt working +``` +log.log_level(info) +``` +I want to make sure this is working ok +``` +log.log_level(cur_level) +``` +reset the logging level back to normal + +## LICENSE + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/content/lua.scripts.api.manual/dtutils.log/engine.md b/content/lua.scripts.api.manual/dtutils.log/engine.md new file mode 100644 index 0000000..988c09a --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/engine.md @@ -0,0 +1,35 @@ +--- +title: engine +id: engine +weight: 30 +draft: false +author: "people" +--- + +## NAME + +engine + +## SYNOPSIS + +get and set the output engine + +## USAGE +``` +local log = require "lib/dtutils.log" +result = log.engine(level, ...) +``` +**level** - _table_ - the log level to get or set the engine for, one of log.debug, log.info, log.warn, log.error +log.success, log.always, log.screen, log.critical +**...** - _function_ - the output function, one of dt.print, dt.print_error, dt.print_log, print +if not function is included, the current engine is returned for the specified log level + +## DESCRIPTION + +**engine** returns the output engine for the specified log level if a second argument is not +supplied. If a function is supplied as the second argment, then the output engine for the specified log level +is set to that. + +## RETURN VALUE + +**result** - _function_ - the current output engine diff --git a/content/lua.scripts.api.manual/dtutils.log/log_level.md b/content/lua.scripts.api.manual/dtutils.log/log_level.md new file mode 100644 index 0000000..afdd0f6 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/log_level.md @@ -0,0 +1,50 @@ +--- +title: log_level +id: log_level +weight: 40 +draft: false +author: "people" +--- + +## NAME + +log_level + +## SYNOPSIS + +get or set the log level + +## USAGE +``` +local log = require "lib/log" +local result = log.log_level(...) +``` +**...** - _arguments_ - if none is supplied, then the current log level is returned as one of: +log.debug, log.info, log.warn, log.error, log.success. If one of log.debug, log.info, log.warn, +log.error, or log.success is supplied as the argument then the log level is set to that value. All +log levels greater than or equal in value will be enabled. Any levels of lesser value will be disabled. + +## DESCRIPTION + +**log_level** gets and sets the logging level. When called with no arguments the current log level +is returned as one of log.debug, log.info, log.warn, log.error, or log.success. When called with one of log.debug, +log.info, log.warn, log.error or log.success then the log level is set. When setting the log level all levels +equal or greater are enabled and any of lesser value are disabled. See the example. + +## RETURN VALUE + +**result** - _log level_ - one of log.debug, log.info, log.warn, log.error or log.success + +## EXAMPLE + +Assume that the current log level is log.error. Calling +``` +log.log_level() +``` + will return log.error. +Calling +``` +log.log_level(log.info) +``` +will leave log.debug disabled, and enable log.info, log.warn, log.error and +log.success. log.info will be returned as the log_level. diff --git a/content/lua.scripts.api.manual/dtutils.log/msg.md b/content/lua.scripts.api.manual/dtutils.log/msg.md new file mode 100644 index 0000000..64b1fc1 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.log/msg.md @@ -0,0 +1,49 @@ +--- +title: msg +id: msg +weight: 50 +draft: false +author: "people" +--- + +## NAME + +msg + +## SYNOPSIS + +print a log message + +## USAGE +``` +local log = require "lib/log" +log.msg(level, ...) +``` +**level** - _table_ - the type of message, one of: +- log.debug - debugging messages +- log.info - informational messages +- log.warn - warning messages +- log.error - error messages +- log.success - success messages +- log.always - an internal message for debugging +- log.screen - output 1 line of text to the screen +- log.critical - print a critical message to the console + +**...** - _string(s)_ - the message to print, which could be a comma separated set of strings + +## DESCRIPTION + +**msg** checks the level to see if it is enabled, then prints the level type and message if it is. +Messages are output using the engine configured in each log level. + +## LIMITATIONS + +If you use log.msg in a callback, the name of the calling routine can't be determined. A solution +is to include some means of reference such as the name of the callback as an argument, i.e. +``` +log.msg(log.debug, "libPlugin.format_combobox:", "value is " .. self.value) +``` +which would result in +``` +DEBUG: callback: libPlugin.format_combobox: value is JPEG +``` diff --git a/content/lua.scripts.api.manual/dtutils.string/_index.md b/content/lua.scripts.api.manual/dtutils.string/_index.md new file mode 100644 index 0000000..f9406e9 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils.string +id: dtutils-string +weight: 50 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils.string/details.md b/content/lua.scripts.api.manual/dtutils.string/details.md new file mode 100644 index 0000000..bb5bc14 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/details.md @@ -0,0 +1,70 @@ +--- +title: details +id: details +weight: 10 +draft: false +author: "people" +--- + +# DTUTILS.STRING + +## NAME + +dtutils.string + +## SYNOPSIS + +a library of string utilities for use in darktable lua scripts + +## USAGE +``` +local ds = require "lib/dtutils.string" +``` +## DESCRIPTION + +This library contains string manipulation routines to aid in building +darktable lua scripts. + +## RETURN VALUE + +_**ds** - library_ - the darktable lua string library + +## FUNCTIONS + +### [escape_xml_characters](escape_xml_characters.md) + +escape characters for xml documents + +### [is_not_sanitized](is_not_sanitized.md) + +check if a string has been sanitized + +### [sanitize](sanitize.md) + +surround a string in quotes making it safe to pass as an argument + +### [sanitize_lua](sanitize_lua.md) + +escape lua 'magic' characters from a pattern string + +### [strip_accents](strip_accents.md) + +strip accents from characters + +### [urlencode](urlencode.md) + +encode a string in a websafe manner + +## LICENSE + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . + diff --git a/content/lua.scripts.api.manual/dtutils.string/escape_xml_characters.md b/content/lua.scripts.api.manual/dtutils.string/escape_xml_characters.md new file mode 100644 index 0000000..d5573da --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/escape_xml_characters.md @@ -0,0 +1,42 @@ +--- +title: escape_xml_characters +id: escape_xml_characters +weight: 20 +draft: false +author: "people" +--- + +## NAME + +escape_xml_characters + +## SYNOPSIS + +escape characters for xml documents + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.escape_xml_characters(str) +``` +**str** - _string_ - the string that needs escaped + +## DESCRIPTION + +**escape_xml_characters** provides the escape sequences for +``` +"&", '"', "'", "<", and ">" +``` +with the corresponding +``` +"&",""", "'", "<", and ">" +``` +. + +## RETURN VALUE + +**result** - _string_ - the string containing escapes for the xml characters + +## REFERENCE + +https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents diff --git a/content/lua.scripts.api.manual/dtutils.string/is_not_sanitized.md b/content/lua.scripts.api.manual/dtutils.string/is_not_sanitized.md new file mode 100644 index 0000000..9d4707e --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/is_not_sanitized.md @@ -0,0 +1,31 @@ +--- +title: is_not_sanitized +id: is_not_sanitized +weight: 30 +draft: false +author: "people" +--- + +## NAME + +is_not_sanitized + +## SYNOPSIS + +Check if a string has been sanitized + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.is_not_sanitized(str) +``` +**str** - _string_ - the string that needs to be made safe + +## DESCRIPTION + +**is_not_sanitized** checks a string to see if it +has been made safe use passing as an argument in a system command. + +## RETURN VALUE + +**result** - _boolean_ - true if the string is not sanitized otherwise false diff --git a/content/lua.scripts.api.manual/dtutils.string/sanitize.md b/content/lua.scripts.api.manual/dtutils.string/sanitize.md new file mode 100644 index 0000000..8278478 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/sanitize.md @@ -0,0 +1,31 @@ +--- +title: sanitize +id: sanitize +weight: 40 +draft: false +author: "people" +--- + +## NAME + +sanitize + +## SYNOPSIS + +surround a string in quotes making it safe to pass as an argument + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.sanitize(str) +``` +**str** - _string_ - the string that needs to be made safe + +## DESCRIPTION + +**sanitize** converts a string into a version suitable for +use passing as an argument in a system command. + +## RETURN VALUE + +**result** - _string_ - a websafe string diff --git a/content/lua.scripts.api.manual/dtutils.string/sanitize_lua.md b/content/lua.scripts.api.manual/dtutils.string/sanitize_lua.md new file mode 100644 index 0000000..a36c215 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/sanitize_lua.md @@ -0,0 +1,31 @@ +--- +title: sanitize_lua +id: sanitize_lua +weight: 50 +draft: false +author: "people" +--- + +## NAME + +sanitize_lua + +## SYNOPSIS + +escape lua 'magic' characters from a pattern string + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.sanitize_lua(str) +``` +**str** - _string_ - the string that needs to be made safe + +## DESCRIPTION + +**sanitize_lua** escapes lua 'magic' characters so that +a string may be used in lua string/patten matching. + +## RETURN VALUE + +**result** - _string_ - a lua pattern safe string diff --git a/content/lua.scripts.api.manual/dtutils.string/strip_accents.md b/content/lua.scripts.api.manual/dtutils.string/strip_accents.md new file mode 100644 index 0000000..3a7e66e --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/strip_accents.md @@ -0,0 +1,35 @@ +--- +title: strip_accents +id: strip_accents +weight: 60 +draft: false +author: "people" +--- + +## NAME + +strip_accents + +## SYNOPSIS + +strip accents from characters + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.strip_accents(str) +``` +**str** - _string_ - the string with characters that need accents removed + +## DESCRIPTION + +**strip_accents** removes accents from accented characters returning the +unaccented character. + +## RETURN VALUE + +**result** - _string_ - the string containing unaccented characters + +## REFERENCE + +Copied from https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string/ diff --git a/content/lua.scripts.api.manual/dtutils.string/urlencode.md b/content/lua.scripts.api.manual/dtutils.string/urlencode.md new file mode 100644 index 0000000..f73c607 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.string/urlencode.md @@ -0,0 +1,35 @@ +--- +title: urlencode +id: urlencode +weight: 70 +draft: false +author: "people" +--- + +## NAME + +urlencode + +## SYNOPSIS + +encode a string in a websage manner + +## USAGE +``` +local ds = require "lib/dtutils.string" +local result = ds.urlencode(str) +``` +**str** - _string_ - the string that needs to be made websafe + +## DESCRIPTION + +**urlencode** converts a string into a websafe version suitable for +use in a web browser. + +## RETURN VALUE + +**result** - _string_ - a websafe string + +## REFERENCE + +https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string \ No newline at end of file diff --git a/content/lua.scripts.api.manual/dtutils.system/_index.md b/content/lua.scripts.api.manual/dtutils.system/_index.md new file mode 100644 index 0000000..7b9b66d --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.system/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils.system +id: dtutils-system +weight: 60 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils.system/details.md b/content/lua.scripts.api.manual/dtutils.system/details.md new file mode 100644 index 0000000..0152e4a --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.system/details.md @@ -0,0 +1,57 @@ +--- +title: details +id: details +weight: 10 +draft: false +author: "people" +--- + +# DTUTILS.SYSTEM + +## NAME + +dtutils.system + +## SYNOPSIS + +a library of system utilities for use in darktable lua scripts + +## USAGE +``` +local dtsys = require "lib/dtutils.system" +``` +## DESCRIPTION + +This library contains routines for interfacing to the operating system from +darktable lua scripts. + +## RETURN VALUE + +**dtsys** - _library_ - the darktable lua system library + +## FUNCTIONS + +### [external_command](external_command.md) + +pass a command to the operating system for execution and return the result + +### [launch_default_app](launch_default_app.md) + +open file in default application + +### [windows_command](windows_command.md) + +pass a command to the windows operating system for execution and return the result + +## LICENSE + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/content/lua.scripts.api.manual/dtutils.system/external_command.md b/content/lua.scripts.api.manual/dtutils.system/external_command.md new file mode 100644 index 0000000..f022fbe --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.system/external_command.md @@ -0,0 +1,30 @@ +--- +title: external_command +id: external_command +weight: 20 +draft: false +author: "people" +--- + +## NAME + +external_command + +## SYNOPSIS + +pass a command to the operating system for execution and return the result + +## USAGE +``` +local dsys = require "lib/dtutils.system" +local result = dsys.external_command(command) +``` +**command** - _string_ - a string containing the command and arguments to be passed to the operating system for execution. + +## DESCRIPTION + +**external_command** passes a command to the operating system for execution and returns the results. + +## RETURN VALUE + +**result** - _number_ = the return value signalling success or failure. diff --git a/content/lua.scripts.api.manual/dtutils.system/launch_default_app.md b/content/lua.scripts.api.manual/dtutils.system/launch_default_app.md new file mode 100644 index 0000000..1801aa0 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.system/launch_default_app.md @@ -0,0 +1,31 @@ +--- +title: launch_default_app +id: launch_default_app +weight: 30 +draft: false +author: "people" +--- + +## NAME + +launch_default_app + +## SYNOPSIS + +open file in default application + +## USAGE +``` +local dsys = require "lib/dtutils.file" +result = dsys.launch_default_app(path) +``` +**path** - _string_ - a file path + +## DESCRIPTION + +**launch_default_app** allows opening a file in the application that is assigned as default +for that filetype in the users's system + +## RETURN VALUE + +**result** - _number_ - the return value signalling success or failure. diff --git a/content/lua.scripts.api.manual/dtutils.system/windows_command.md b/content/lua.scripts.api.manual/dtutils.system/windows_command.md new file mode 100644 index 0000000..21ce591 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils.system/windows_command.md @@ -0,0 +1,32 @@ +--- +title: windows_command +id: windows_command +weight: 40 +draft: false +author: "people" +--- + +## NAME + +windows_command + +## SYNOPSIS + +pass a command to the windows operating system for execution and return the result + +## USAGE +``` +local dsys = require "lib/dtutils.system" +local result = dsys.windows_command(command) +``` +**command** - _string_ - a string containing the command and arguments to be passed to the operating system for execution. + +## DESCRIPTION + +The normal method of executing an operating system command is using dt.control.execute(), but that doesn't +work with Windows when more than one item in the command is quoted. In order to ensure command execution on Windows we +create a batch file in the temporary directory, put the command in it, execute the batch file, then return the result. + +## RETURN VALUE + +**result** - _number_ - the return value signalling success or failure. diff --git a/content/lua.scripts.api.manual/dtutils/_index.md b/content/lua.scripts.api.manual/dtutils/_index.md new file mode 100644 index 0000000..3e6576a --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils/_index.md @@ -0,0 +1,7 @@ +--- +title: dtutils +id: dtutils +weight: 10 +draft: false +author: "people" +--- diff --git a/content/lua.scripts.api.manual/dtutils/check_min_api_version.md b/content/lua.scripts.api.manual/dtutils/check_min_api_version.md new file mode 100644 index 0000000..f349efd --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils/check_min_api_version.md @@ -0,0 +1,50 @@ +--- +title: check_min_api_version +id: check_min_api_version +weight: 20 +draft: false +author: "people" +--- + +## NAME + +check_min_api_version + +## SYNOPSIS + +check the minimum required application programming interface (API) version against the current API version + +## USAGE +``` +local du = require "lib/dtutils" +local result = du.check_min_api_version(min_api, script_name) +``` +**min_api** - _string_ - the API version that the application was written for (example: "5.0.0") +**script_name** - _string_ - the name of the script + +## DESCRIPTION + +**check_min_api_version** compares the minimum API required for the application to +run against the current API version. The minimum API version is typically the API version that +was current when the application was created. If the minimum API version is not met, then an +error message is printed saying the script_name failed to load, then an error is thrown causing the +program to stop executing. + +This function is intended to replace **darktable.configuration.check_version()**. The application code +won't have to be updated each time the API changes because this only checks the minimum version required. + +## RETURN VALUE + +**result** - _boolean_ - true if the minimum API version is available, false if not. + +## LIMITATIONS + +When using the default handler on a script being executed from the luarc file, the error thrown +will stop the luarc file from executing any remaining statements. This limitation does not apply to script_manger. + +## EXAMPLE +``` +check_min_api_version("5.0.0") +``` +does nothing if the API is greater than or equal to 5.0.0 otherwise an +error message is printed and an error is thrown stopping execution of the script. diff --git a/content/lua.scripts.api.manual/dtutils/check_os.md b/content/lua.scripts.api.manual/dtutils/check_os.md new file mode 100644 index 0000000..d3a6619 --- /dev/null +++ b/content/lua.scripts.api.manual/dtutils/check_os.md @@ -0,0 +1,42 @@ +--- +title: check_os +id: check_os +weight: 30 +draft: false +author: "people" +--- + +## NAME + +check_os + +## SYNOPSIS + +check that the operating system is supported + +## USAGE +``` +local du = require "lib/dtutils" +local result = du.check_os(operating_systems) +``` +**operating_systems** - _table_ - a table of operating system names such as {"windows","linux","macos","unix"} + +## DESCRIPTION + +**check_os** checks a supplied table of operating systems against the operating system the +script is running on and returns true if the OS is in the list, otherwise false + +## RETURN VALUE + +**result** - _boolean_ - true if the operating system is supported, false if not. + +## EXAMPLE +``` +local du = require "lib/dtutils" +if du.check_os({"windows"}) then + -- run the script +else + dt.print("Script