[luatex] texlua vs. luatex

Reinhard Kotucha reinhard.kotucha at web.de
Mon Apr 22 20:51:53 CEST 2013


On 2013-04-22 at 11:29:22 +0200, Élie Roux wrote:

 > Dear all,
 > 
 > 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.
 > 
 > I cannot try texconfig.formatname nor texconfig.jobname as these are 
 > never filled in the formats in TeXLive (this is something I would like 
 > to address soon).
 > 
 > I tried to look into ConTeXt sources, but I did not manage to find a 
 > clue (especially since I don't know the sources well)...
 > 
 > What would be the best solution?

This is what I did in one of my modules:

  local function writemsg (...)
    if token == nil then
      io.write(string.format(...)..'\n')
    else
      texio.write_nl(string.format(...)..'\n')
    end
  end

The token table isn't accessible from texlua.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------



More information about the luatex mailing list