firstchildΒΆ

Node|nil child firstchild ( Node node , string|{string} type , [ string|function pattern ] , [ boolean recursive ] )

Find the first child in a node that match the search parameters

The firstchild function is written as:

function firstchild (...)
    for child in children (...) do
        return child
    end
end
Arguments:

  • node The node to search into
  • type A class or list of classes the child must belong to
  • pattern A Lua's pattern used to check the name of the node, or a function that filter the node. See Lua's pattern documentation.
  • recursive if true, traverse the whole parent hierarchy.

Return:

  • child The first child found or nil if none matches