Added check_min_api_function to dtutils.lua to check the minimum version of the lua API required for a script to run. This is intended to replace the API check done with darktable.configuration.check_version(), which requires changing each time the API version changes. check_min_api_version should work for all API version changes unless backward compatibility is broken. All the scripts using darktable.configuration.check_version() were changed to use check_min_api_version().
This commit is contained in:
@@ -22,7 +22,12 @@ USAGE
|
||||
* require this script from your main lua file
|
||||
]]
|
||||
local dt = require "darktable"
|
||||
dt.configuration.check_version(...,{2,0,1},{3,0,0},{4,0,0},{5,0,0})
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
if not du.check_min_api_version("2.0.1") then
|
||||
dt.print("ERROR:preferenceExamples failed to load. Lua API version 2.0.1 or greater required.")
|
||||
return
|
||||
end
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
|
||||
Reference in New Issue
Block a user