[..snip..]
Breadth-first may not be what you want, either, but in any event to
implement it you need to bypass the Lua __index mechanism, since you
need an actual tree of inheritances.
However, you might want to look at this paper:
http://www.webcom.com/haahr/dylan/linearization-oopsla96.html
which discusses various algorithms for ordering inheritance orders.
C3 was the algorithm selected for Python, I believe.
Doing this computation dynamically is probably too time-consuming;
either the computation should be done when the class is created, or
cached
when it is first needed.