18 Sep
2007
18 Sep
'07
11:04 a.m.
Jonathan Sauer wrote: > 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. That is not possible right now, but adding a simple interface would be pretty straightforward. However ... influencing the lua interpreter is not doable, so error recovery is impossible (deleting and inserting tokens will be disabled), and the error context will likely be useless. Therefore, it will not be real user interaction, more a "press return to acknowledge that you saw the error". > 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? Not now, but it is planned for the future. Best wishes, Taco