pothi.love/0143-find_node

16 lines
316 B
Plaintext

find_node = function(node, id)
if node.type == 'text' and not node.button then
if node.id == id then
return node
else
return nil
end
end
if node.type == 'rows' or node.type == 'cols' then
for _,child in ipairs(node.data) do
local t = find_node(child, id)
if t then return t end
end
end
end