[luatex] Absolute beginners questions

Paul Isambert zappathustra at free.fr
Fri Sep 30 09:26:04 CEST 2011


Le 30/09/2011 08:53, Keith J. Schultz a écrit :
> Hi Peter,
>
> I am so to say an very advanced programmer, but I have never liked
> the TeX way of doing things nor have I tried to really learn TeX.

So welcome to LuaTeX :)
(Although the TeX way was a good source of amusing puzzles; and might 
not fade so soon.)

> I had seen the reference, but as you said it is quite low level and more aimed
> towards the TeX use.

The wiki lists other sources of info (and don't forget the wiki itself): 
http://wiki.luatex.org/index.php/Documentation_and_help

> My main interest is what I have to pass to the lua interpreter

This depends on what you want to do. Without an example, it is hard to 
say what you "have to" pass.

>   and what I can access from
> with in it.

TeX internals (baselineskip, maxdepth and the likes), plus all 
count/box/... registers, plus callbacks and lists of nodes (the most 
interesting part). Also, again, without an example, it's a bit hard to 
make a sensible answer.

>    Here the Lua(La)TeX documentation is so what vague. It seem also to suggest
> that each call to lua are singular and can not themselves share their state between them and
> if the globals where glaobals to TeX or the lua interpreter.

\directlua calls are Lua chunk, meaning what is local in a \directlua 
call is undefined in other calls; otherwise global variables are 
accessible from all chunks. See for instance:

\directlua{%
   local foo = "foo" % Local variable
   bar = "bar" % Global variable
   }
\directlua{
   texio.write_nl(foo or "nothing") % Prints "nothing"
   texio.write_nl(bar or "nothing") % Prints "bar"
   }

As for the globals being globals to TeX or Lua, I'll admit I don't 
understand the question. Globals in TeX and globals in Lua are different 
things and do not interact; the former are related to TeX groups, the 
latter to Lua chunks.

> For right know all I need to do is inject the proper commands into the TeX engine.

Again, "proper" without an example is a bit vague. Could you be more 
precise?

Best,
Paul


More information about the luatex mailing list