[luatex] Inspect last node without removing

Henri Menke henrimenke at gmail.com
Fri Aug 3 02:47:53 CEST 2018


Dear list,

Sometimes I want to break out into Lua during typesetting and just 
inspect the last node at the current point.  LuaTeX gives me the 
opportunity to get the last node using node.last_node().  However this 
pops the node from the list, i.e. it disappears from the output stream. 
I don't want this.  I simply want to inspect the node and maybe insert 
something in the current list.  I'm not even able to reinsert the node 
because node.write(node.copy(last)) confuses the parbuilder.  Also, how 
can I get the current list?  MWE below.

Cheers, Henri

---

a%
\directlua{
local last = node.last_node()
node.write(node.copy(last))
}
\bye


More information about the luatex mailing list