[luatex] luatex manpage not quite the status quo
Dirk Laurie
dirk.laurie at gmail.com
Sun Mar 8 06:50:00 CET 2015
It says: "Run the luaTeX typesetter on TEXNAME, usually creating
TEXNAME.pdf. ... If called as texlua it acts as lua interpreter."
There are two gotchas here.
1. The clear implication is that if called as `luatex` it treats the input
file as TeX. In fact, if the filename ends in `.lua`, it treats it as Lua.
This is good, it is what the user would expect — but the manpage
does not say so.
2. Input cannot come from STDIN, a filename must be given,
but `texlua myfile.lua` does not give the same behaviour as
`lua myfile.lua` would have. The difference is subtle.
The behaviour is as if the lines of `myfile.lua` were entered one
by one in interactive mode. That is to say, the scope of all local
variables ends at the end of the line they are defined on, unless
they are inside an unclosed block. This causes a perfectly valid
Lua script to fail when run by texlua.
I cannot think of a good reason why this behaviour might be
desirable. It IHMO would be preferable to make `texlua` behave
exactly like `lua`. But if there is some subtle reason for it, maybe
the manpage could warn the user about it.
More information about the luatex
mailing list