Avoid unnecessary table creation and unpacking in examples/tree.lua