% Bugs: % 0-3: \prevdepth/\prevgraf problems. % 4-5: node fields problems. % % Bug #3 seems to be the crux of the biscuit, but I'm no good judge. % Choose your bug: \chardef\bug=0 \ifcase\bug % 0 % tex.prevdepth is supposed to be read-only, according to the manual. Yet: % (Also with prevgraf.) \directlua{ tex.prevdepth = 100 texio.write_nl(tex.prevdepth) } \or % 1 % Improper prevdepth? Disappears if the following line is uncommented. %\directlua{tex.prevdepth = 0} \quitvmode\directlua{texio.write_nl(tex.prevdepth)} \or % 2 % (This might be just a side-effect/particular case of the following problem.) % % Disconnection between tex.prevdepth and \prevdepth. (Also with prevgraf.) % Less clear to me, though, I might have misunderstood something. % % write_nl prints -65536000 as expected for the first paragraph. For the % second, however, it prints 0, i.e. the \prevdepth declaration isn't taken % into account. Now it is taken into account if you remove the line: % % tex.prevdepth = info.prevdepth % % But then prevdepth isn't automatically updated; so I guess setting % tex.prevdepth to info.prevdepth is required when breaking paragraph by hand % (unless, well, see next bug). \directlua{ callback.register("linebreak_filter", function (head) texio.write_nl(tex.prevdepth) local par, info = tex.linebreak(head) tex.prevdepth = info.prevdepth return par end)} abc\par \prevdepth=-10000pt abc \or % 3 % The paragraph's first node is an hlist for the first two paragraphs, and a % glue for the third (and any following paragraphs). In other words, it is as % if tex.linebreak takes prevdepth into account if and only if it has already % been set with \prevdepth (not tex.prevdepth). \directlua{ callback.register("linebreak_filter", function (head) local par = tex.linebreak(head) texio.write_nl(par.id) return par end)} abc\par abc\par \prevdepth=0pt %\directlua{tex.prevdepth = 0} % Doesn't work the Lua way. abc\par \or % 4 % Prints "subtype" among others, although temp nodes have no subtype (also % with action items 49, and probably other); also, prints "next" (for 50) and % "next" and "prev" (for others), which is probably on purpose, although it % might lead to error when investigating an isolated node. \directlua{ for _, f in pairs(node.fields(0)) do texio.write_nl(f) end} % Correlatively, validates an unexisting field: \directlua{ local n = node.new(50) if node.has_field(n, "subtype") then texio.write_nl("Something's wrong.") end } \or % 5 % And a crash (only with 50, as far as I can tell): \directlua{ local n = node.new(50) local x = node.has_field(n, "foo") } \fi \end