Copy link to clipboard
Copied
Having progressed my keywording script, I've one task left which is to extend a function that creates a map of keyword name -> id so that it handles child keywords. I naively tried:
local function find_all_keywords()
local all_keywords = {}
local function find (keyword)
all_keywords[keyword:getName()]=keyword.localIdentifier
for _, child in ipairs (keyword:getChildren()) do find (keyword) end
end
for _, keyword in ipairs (catalog:getKeywords ()) do find (keyword) end
return all_keywords
end
However, when executing this, it creates a stack overflow which I don't understand. My keywords are only about 5 deep, and I think my logic would only attempt to find children of parents which should terminate at each leaf node?
?:0: stack overflow
The sixth line should be:
for _, child in ipairs (keyword:getChildren()) do find (child) end
Copy link to clipboard
Copied
The sixth line should be:
for _, child in ipairs (keyword:getChildren()) do find (child) end
Copy link to clipboard
Copied
🤦 Doh. I was certain I'd hit some slightly wierd Lua perculiarty. But no, after 25 years of profession software engineering, it was a stupid typo. Thanks.
My script is now ready to process my 15k of images that I've exported out of C1.
Thank you again.