# [luatex] scanning for undefined command names

David Carlisle d.p.carlisle at gmail.com
Wed Oct 26 14:25:56 CEST 2016

Hans,

> there is no token \UNDEFINED so it cannot be reported as such

I think that is a terminology problem that is the source of the confusion.

there is no entry in the internal table of control names that
presumably you are looking up here but \UNDEFINED is a token in the
usual TeX sense \UNDEFINED can take part in token lists
\def\foo{\UNDEFINED}  if  \UNDEFINED isn't a "token" what is it?

Actually while writing the above, I guessed that the following would
work and in fact it does

\def\z{\UNDEFINED}
\directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\par
\directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\par
\directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\UNDEFINED
\directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\UNDEFINED

produces

[par]
[par]
[UNDEFINED]
[UNDEFINED]

but I wonder if the manual could be clarified, not everyone would guess that:-)

David