[Dev-luatex] # => ## in \directlua

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Tue Oct 7 13:05:25 CEST 2008


Hello,

take the following PlainTeX file:

%&luatex
\def\recatcode#1{%
	\directlua0{%
		tex.sprint('\luaescapestring{\unexpanded{#1}}')%
		texio.write_nl('\luaescapestring{\unexpanded{#1}}')%
	}%
}

\recatcode{%
	\def\test#1{`#1'}%
}

\bye


This results in

This is LuaTeX, Version snapshot-0.30.0-2008093018 (Web2C 7.5.7)
(MacroParameterCharacter.tex
\def \test ##1{`##1'}
! Parameters must be numbered consecutively.
<to be read again> 
                   ##
l.1 \def \test ##
                 1{`##1'}
\recatcode ...uaescapestring {\unexpanded {#1}}')}
                                                  
l.12 }
      
? x
TeX interrupted.  No pages of output.
Transcript written on MacroParameterCharacter.log.


So `#' is transformed into `##' when passed from TeX to Lua. Is this a
bug or a feature?


Jonathan



More information about the dev-luatex mailing list