Hi, I'm trying to do some Lua scripting, and I run into a problem that I do not understand. Install this simple script, and bind the provided funtion "foo" to a shortcut button.
local dt = require "darktable" local function foo() print("________________________________________") print("--- action images ---") for _, i in pairs(dt.gui.action_images) do print(i.id, i) end print("--- collection ---") for _, i in pairs(dt.collection) do print(i.id, i) end end dt.register_event("shortcut", function(_, _) foo() end, "foo") When the function is invoked, it should print the image IDs of all images in the collection, and also the image IDs that would be affected by actions like, eg., color labeling. Take two images that are not next to each other, and give them a unique color label. Limit the collection to that. Now invoking that function here always lists an image as part of the collection that is not part of the collection! And one of the images in the collection, clearly visible in lighttable, is not listed in the collection. Whassup? Is there as seasoned Lua+DT hacker observing this? I have verified this even on a pristine database on freshly imported directory raws, without sidecars in that directory: rm -rf /tmp/dtlib rm -rf /tmp/dttest/*xmp darktable --library /tmp/dtlib -d lua /tmp/dttest By the way: Is there any good reason why `dt.gui.action_images` and `dt.collection` do not return a table that maps the image id to the image? Thanks Stefan -- http://stefan-klinger.de o/X Send plain text messages only, not exceeding 32kB. /\/ \ ------------------------------------------------------------------------------ _______________________________________________ Darktable-users mailing list Darktable-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/darktable-users