Open disgustipated opened 1 week ago
Yeah, I'm not understanding why the nested loop doesnt hit the second item. With this code i get the listing outside fine but in the inside loop im only getting the first item.
function applyTags(nodes, tags)
log(" incoming tag ")
log(json(tags))
for g,t in next, tags do
log("listing tags outside" .. g .. " " .. t)
end
for i, node in ipairs(nodes) do
log("before file check " .. i .. " " .. node.name)
if( is_file(node) )then
log("node is a file " .. i .. " " .. node.name)
for g,t in next, tags do
log("listing tags inside" .. g .. " " .. t)
end
elseif( is_folder(node) )then
--loop through list var and apply tag to each file directory_listing(node)
end
end
end
applyTags(get_input_files(), get_input('PrintSize'))
yeah there is something that is going on with counting through the loop, if i have two files selected i get the listing tags inside twice as expected on the first file, but the second file only does the first item. i didnt see it at first because i was only selecting a single file while testing.
perhaps this is my lack of knowledge of lua, but im having trouble getting reliable output as im working on a script with the end goal of applying tags to files. i have the following script outputting to log while im getting familiar
that produces the log output like this, but doesnt list the second file
and this
produces the log output "before file check" but seems the is_file doesnt happen and the "node is file" log doesnt get output. im not sure if im troubleshooting log output or my lack of knowledge of lua and could use some help understanding whats going on