Hello,
I have just committed code that implements this same extension for \latexlua (#1300). Some small tests seem to indicate it works, but I have not been exhaustive so it would be nice if you could do some tests as well.
I tested it using the following PlainTeX file: %&luatex % \pdfoutput=1 % A \def\llua#1{% \latelua name{\jobname-\the\inputlineno}0{#1}% } \def\dlua#1{% \directlua name{\jobname-\the\inputlineno}0{#1}% } \def\test{foo} \dlua{error("dlua 1")} Line 1 \llua{error("llua 1: \test")} Line 2 \llua{error("llua 2: \test")} Line 3 \llua{error("llua 3: \test")} Line 4 \llua{error("llua 4: \test")} Line 5 \dlua{error("dlua 2")} \def\test{bar} \bye This results in: This is LuaTeX, Version snapshot-0.25.3-2008060319 (Web2C 7.5.6) (LateLuaTest.tex ! LuaTeX error <LateLuaTest-12>:1: dlua 1 stack traceback: [C]: in function 'error' <LateLuaTest-12>:1: in main chunk. \dlua ...a name{\jobname -\the \inputlineno }0{#1} l.12 \dlua{error("dlua 1")} ? ! pdfTeX error (\latelua): not allowed in DVI mode (\pdfoutput <= 0). \llua #1->\latelua name{\jobname -\the \inputlineno }0{#1} l.15 \llua{error("llua 1")} No pages of output. Transcript written on LateLuaTest.log. (note that this is independent on whether a chunk name is specified or not) After uncommenting line (A) to enable PDF mode, everything worked perfectly. Two points: (1) The manual states that \latelua is similar to \pdfliteral, so this might be the expected behaviour. OTOH, \latelua is also useful to access information only available in the output routine, such as the current page number (i.e. when implementing cross references in Lua). (2) IMO, \latelua should be modeled after \write, which (of course) also works in DVI mode but which also delays expansion of its argument to shipout. \latelua expands its argument completely when issued, as demonstrated above by displaying "foo" in the error message instead of "bar". (the chunk name should still be expanded when the command is issued, in order to get the then-current input line number) What do you think?
Best wishes, Taco
Jonathan