On 2016-Jan-08, Christian wrote with possible deletions: > I'm not a seasoned DT+LUA guy.
Nobody seems to be ;-) But I'm happy someone else also observes this effect. > The LUA API [0] tells that dt.collection only returns a numerical index > not the image ID and filtering does not change the collection? > What should be dt.collection for? My understanding of the (not so good) documentation is this: “`darktable.collection` Allows to access the currently worked on images, i.e the ones selected by the collection lib.” so this represents the collection [3] “Filtering (rating etc) does not change that collection.” Planily wrong, as can be observed by testing. “`darktable.collection.#`” The hash is a typo. AFAIK this is not at all valid Lua syntax. “types.dt_lua_image_t” Written the way it is, the documentation claims that this would be the type of `darktable.collection`, which is wrong. If it was true, one could access the `id` field [1]. But trying to do so generates a Lua error: field "id" not found for type dt_lua_singleton_image_collection I have tried to find doc on `dt_lua_singleton_image_collection`, but to no avail. So I boldly assume that it is the type of the items contained in `darktable.collection` “Each image in the collection appears with a numerical index; you can interate them using ipairs.” This finally reveals that `darktable.collection` can be iterated over [2]. As I've described earlier, it would be smarter to return a table instead of assigning volatile and meaningless numbers to the images. Further testing with my previously posted Lua function `foo` gives me the impression that the `id` field of items in `darktable.collection` always have consecutive numbers, not necessarily starting with one. It is a bug, is it? Stefan ____________________ [0] http://www.darktable.org/lua-api/index.html.php#darktable_collection [1] http://www.darktable.org/lua-api/ar01s02.html.php#types_dt_lua_image_t [2] http://www.lua.org/manual/5.3/manual.html#pdf-ipairs [3] http://www.darktable.org/usermanual/ch02s03s02.html.php -- 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