🔗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.</description>
🔗SYNOPSIS check that the operating system is supported
🔗USAGE local du = require &quot;lib/dtutils&quot; local result = du.check_os(operating_systems) operating_systems - table - a table of operating system names such as {&ldquo;windows&rdquo;,&ldquo;linux&rdquo;,&ldquo;macos&rdquo;,&ldquo;unix&rdquo;}
🔗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.</description>
🔗USAGE local du = require &quot;lib/dtutils&quot; du.deprecated(script_name, deprecation_time) script_name - string - the name of the script, i.e. &ldquo;contrib/clear_GPS&rdquo;
deprecation_time - string - when the script will be removed, i.e. &ldquo;darktable release 4.0&rdquo;
🔗DESCRIPTION deprecated gives users a warning that a script is outdated or no longer useful and will be removed at the specified time</description>
🔗USAGE local du = require &quot;lib/dtutils&quot; local status, lib = du.prequire(req_name) req_name - string - the filename of the lua code to load without the &ldquo;.lua&rdquo; filetype
🔗DESCRIPTION prequire is a protected require that can survive an error in the code being loaded without bringing down the calling routine.
🔗RETURN VALUE status - boolean - true on success lib - if status is true, then the code, otherwise an error message</description>
🔗SYNOPSIS an iterator that provides sorted pairs from a table
🔗USAGE local du = require &quot;lib/dtutils&quot; for key, value in du.spairs(t, order) do -- do something end t - table - table of key, value pairs order - function - an optional function to sort the pairs, if none is supplied, table.sort() is used
🔗DESCRIPTION spairs is an iterator that returns key, value pairs from a table in sorted order.</description>
🔗USAGE local du = require &quot;lib/dtutils&quot; local result = du.split(str, pat) str - string - the string to split
pat - string - the pattern to split on
🔗DESCRIPTION split separates a string into a table of strings. The strings are separated at each occurrence of the supplied pattern. The pattern may be any pattern as described in the lua docs.</description>