[luatex] The node returned by node.traverse().

Paul Isambert zappathustra at free.fr
Wed Feb 15 09:02:26 CET 2012


Hello there,

I have a problem with the identity, so to speak, of nodes returned by
node.traverse(); I don't know if I'm missing something (perhaps related
to Lua rather than LuaTeX) or what. The following code should illustrate
the problem (I do not bother with breaks since there is only one node in
the list and one entry in the table):

%%%%%%%%%%%
\setbox0=\hbox{a}

\directlua{
  local head = tex.box[0].head
  local t = { [head] = true }
  for n in node.traverse(head) do
    texio.write_nl(tostring(t[n]))
    texio.write_nl(tostring(n == head))
    for a in pairs(t) do
      if a == n then
        texio.write_nl("They match!")
      end
    end
  end
}

\bye
%%%%%%%%%%%

This prints "nil/true/They match!"; the second and third messages show
that "n" is recognized as being the same thing as "head"; yet the first
message would show that this is not the case.

Am I overlooking something, or should I pay a visit to Bugtracking Palace?

Best,
Paul



More information about the luatex mailing list