[luatex] Strategy for creating a nodelist

Patrick Gundlach patrick at gundla.ch
Tue Mar 9 19:35:58 CET 2010


Hello,

I wonder what is the best strategy for creating a (double linked) node list.

Let's say I want to create a list containing the three gylph_nodes T, E, and X. One way would be 

----------
t = node.new(glyph_node)
t.font = 1
t.char = string.byte("T")

e = node.new(glyph_node)
e.font = 1
e.char = string.byte("E")

x = node.new(glyph_node)
x.font = 1
x.char = string.byte("X")

t.next = e
e.next = x

node.slide(t)
----------

Looking at the documentation, node.insert_after() looks very much like what I want to use. But I don't quite understand its use when the head node is nil.

For node.insert_after() I need a valid "current" node and a valid "new" node. But that would mean that I already have a head in form of the "current" node, right?

Patrick





More information about the luatex mailing list