[luatex] Creating a token list

Javier Bezos listas at tex-tipografia.com
Wed Mar 6 15:22:39 CET 2019

> I have no idea what you mean.  Your description is very unclear.

1) What I want is to create a whatsit node with
subtype write. The code to be written is, say,
\string\doit{\the\lastypos}. This subtype has a
field named data, with a table representing the
token list to be written. So, I write:

local n = node.new(8, 1)
n.stream = 1
n.data =       -- ???

My original question was how to generate in lua
the token list to feed the data field (ie, ???)

2) I've managed to do it by the procedure I explained
in my second message, like this:

\setbox0\hbox{\write1{\the\lastxpos}}

\directlua{

texio.write(' ** ' .. d[1] .. '/' .. d[2] .. '/' .. d[3])
end

}

Well, instead of printing it I pass it to n.data and
primitives work as expected (user defined macros fail,
but this is a minor problem because adding them as a
list of chars when the data table is built is easy).

But this looks much like a hack.

Javier