# [luatex] Behavior of node lists.

Paul Isambert zappathustra at free.fr
Mon Jul 4 09:06:50 CEST 2011

Hello all,

Problem 1:
%%%
\setbox0=\hbox{01}

\directlua{
local done
texio.write_nl("Considering " .. string.char(n.char))
if not done then
local next = n.next
done = true
end
end}

\box0 \bye
%%%

When you consider "0", you remove both "0" and "1", so you'd expect the
loop to end there; but no, "1" is considered too (even though the box is
really empty). The strange things is that if you do not remove "0", then
"1" isn't considered; as if node.traverse is a bit lost when you remove
both the current node and the one it's supposed to scan next. (As far as
I can see, this doesn't hinge on "0" being the head of the list.) Is
this a bug, or have I misunderstood something?

Problem 2: -- A question, rather.
The manual says you're in charge of ensuring that in
"node.insert_after(H, N, x)", N is in the list denoted by H. The thing
is, H doesn't seem to matter at all, unless it's nil:

\setbox0=\hbox{X}
\setbox1=\hbox{abc}

\directlua{
% Works too:
}

\box1
\bye

So what's the need to denote the list where the insertion occurs if it
is ignored? In other words, couldn't node.insert_after and associates
work with only two arguments?

Best,
Paul