[luatex] Short command names and token.set_macro

Harald Hanche-Olsen harald.hanche-olsen at ntnu.no
Tue Dec 10 20:26:49 CET 2019


Consider the following tex file:

\directlua{require "foo"}
\show\foo
\bye

where foo.lua is the single line

token.set_macro("foo","\\,")

When I run this, the result is as follows:

> \foo=macro:
->BAD,.

I understand how and why similar behaviour happens if \, is replaced by some command name that is NOT known from before, such as \foo. But \, IS known, so I had expected this to work. The same happens with any non-letter command name that I have tried. (I originally ran into this in lualatex, where I wanted to build a command expanding to a bunch of strings separated by \\, encoded as \\\\ in the lua strings of course.)

Is it a bug, or have I misunderstood how this works?

(This is with TL 2019 on a mac. Luatex 1.10.0.)

– Harald




More information about the luatex mailing list