Jonathan Sauer wrote:
This means that if I use \directlua alone or with \unexpanded, I can have empty lines in the Lua source, since they are ignored. If I use \detokenize, however, they result in a \par and consequently a parse error (unless in a Lua string, then they result in an inserted "par ").
Is this a bug? A feature?
My current guess is 'feature'. The tokentostring function for \directlua has 'inhibit_par' turned on, so that you don't get those pesky \par's that confuse the lua parser. The output from \detokenize is simply passed on, because it is not a \par token. General remark: suck attempts to squeeze tex input to behave like lua source code are hard to debug and even harder to predict. It is much less confusing if you create either an environment like \startluacode .. \stopluacode with appropriate catcode changes, or if you put the lua code in a separate file and dofile('thefile'). Best wishes in any case, Taco