On 5/27/2025 7:23 AM, Linas Stonys wrote:
I think it is a bug. Luatex tries to expand data field content like with \edef thats why you get \iffalse.
With older texlive (v0.76) the same example prints:

we now have luatex 1.12 so that is indeed old ... way too old to bother about here

table: 03420800
table: 034212F0
table: 03421318

\documentclass{article}
\begin{document}
\directlua{
   callback.register('vpack_filter',
     function(head)
       if node.type(head.id) == 'whatsit' and head.subtype == 1 then
         print (head.data)
       end
       return true
     end,
     'debug'
   )
}
\begin{figure}
   \caption{test}
\end{figure}
\end{document}



On 5/17/2025 1:54 PM, Josef Friedrich wrote:
I’m the maintainer of the nodetree package. I got a bug report: https://github.com/Josef-Friedrich/nodetree/issues/46
I was able to narrow down the problem:

debug.tex:

\documentclass{article}
\begin{document}
\directlua{
   luatexbase.add_to_callback('vpack_filter',
     function(head)
       if node.type(head.id) == 'whatsit' and head.subtype == 1 then
         local tmp = head.data
       end
       return true
     end,
     'debug'
   )
}
\begin{figure}
   \caption{test}
\end{figure}
\end{document}

lualatex debug.tex:

! Incomplete \iffalse; all text was ignored after line 19.
<inserted text>
\fi
l.19 \end{figure}
The line 'local tmp = head.data' causes the error. I tried also 'print(head.data)' or 'local tmp = head['data']'. These access types also caused a crash.

Access to fields other than data works without any problems.

   print(head.stream)
   print(head.id)
   print(head.xxx)

Is this a bug in LuaTeX? Or how can I access the field 'data' of a whatsit(write) node for debugging purposes?

A tex error is not a crash and normally not a bug either. I suggest you look into what the "data" field gets set to which is unclear from your example.

\directlua{
    callback.register('vpack_filter', function(head)
        if node.type(head.id) == 'whatsit' and head.subtype == 1 then
            print(head.data)
        end
        return true
    end)
}

          \def\hello{\iftrue true\else false\fi}
          \def\world{\iftrue true\else false\fi}
\protected\def\HELLO{\iftrue TRUE\else FALSE\fi}
\protected\def\WORLD{\iftrue TRUE\else FALSE\fi}

\noindent \directlua{
    local n = node.new("whatsit",1)
    n.data = [[(\hello\world)(\HELLO\WORLD)]]
    print(n.data)
    tex.print(n)
}
test test test

\bye

So maybe use \tracingall in your latex example code to get an idea what is going on?

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
dev-luatex mailing list -- dev-luatex@ntg.nl
To unsubscribe send an email to dev-luatex-le...@ntg.nl

Reply via email to