Hello, thanks for your quick reply!
[...]
- How do I generate an error when inside Lua code? I could use tex.write("\\errmessage{...}"), but then the error would only be generated after the Lua code has finished executing, and after any TeX code created previously using tex.write et.al. has been executed.
- assert - just print messages using texio.write_nl - os.exit() also works
The last one is a bit radical ;-) I was hoping to be able to say i.e. "error(message,help)" and get TeX's error prompt where the user can decide how to proceed.
- How do I access control sequences from Lua code? If I have a macro \test, how would I get the tokens of this macro when inside Lua? (without passing them from TeX) Is there a table tex.macro, just like the tex.count, tex.toks etc. tables?
no, you print them to tex using tex.print and tex.sprint; you're either is lua or in tex; something in between would become extremely messy
But what about the other way round? What if I do not want to define control sequences, but access their meaning from Lua code, just as it is possible with registers? Is there a way? Jonathan