#Node length operator

Using the length operator # will return the number of child nodes contained in the current node.

Example

local xml = require 'xml' local root = xml.Node('root') root:add('child1', 'Hello') root:add('child2', 'World') print(#root)