Jonathan Sauer wrote:
Hello,
So `#' is transformed into `##' when passed from TeX to Lua. [...] This currently uses TeX's tokenlist print function, but I could make it behave differently, no problem (after all, this generated string is only 'seen' by the lua interpreter). In that case: Please make it so. It is consistent with TeX's printing mechanism.
Sure. But I don't think that this consistency is necessary. Also, I would guess that "#" in a token register is not doubled when the token register is accessed from Lua, so it would be consistent with how "#" between TeX and Lua is handled there.
Actually the problem was with \luaescapestring. Commit #1544 changes the behaviour of \luaescapestring so that it no longer duplicates characters with catcode 6. Please verify that that does what you want. Best wishes, Taco