[luatex] texlua vs. luatex

Dirk Laurie dirk.laurie at gmail.com
Mon Apr 22 15:11:49 CEST 2013

2013/4/22 Élie Roux <elie.roux at telecom-bretagne.eu>:

> I'm in front of a strange problem: I have a .lua script that can be called
> from both luatex and texlua, and I would like to have a different behaviour
> according to the caller. The problem is that I cannot find a reliable way to
> know if the script is called with texlua or luatex...
> I cannot inspect arg[0] because some scripts are just symbolic links to
> texlua or luatex and it's impossible to have information from it.

Why arg[0]? That's the script name. The name of the executable is arg[-1].

In many installations texlua and luatex is physically the same executable.
For instance, in Linux TeXLive 2012 texlua is simply a symlink to luatex,
So even in principle you only have the name it was called by to guide you.

More information about the luatex mailing list