[NTG-context] printing tab in lua: print('a\tb') fails

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed Nov 26 20:28:16 CET 2008

Am 26.11.2008 um 20:07 schrieb Mojca Miklavec:

> Hello,
> Here's a tiny question. The following command complains about
> undefined control sequence.
> \starttext
> \startluacode
> print('a\tb')

print('a\t b')

> \stopluacode
> hello
> \stoptext
> There is a workaround:
>    print(string.format('a\t%s', 'b'))
> but I find it weird. Even if the line above gets commented out with
> two dashes it still complains.
> I understand approximately why this happens, but is that intended?
> Should I be using something else than \startluacode in the plethora of
> different lua triggering commands?

\start/stopluacode is defined as \startluacode#1\stopluacode
(simplified) and you should take care of TeXs parsing rules.

If you want Lua comments and format command (\n, \t ...) use
a external file for your Lua code.


More information about the ntg-context mailing list