10

still looking for LuaTeX, I understand how I can execute Lua code insided TeX code (via \luadirect) but not how I could execute TeX code inside Lua code.

I explain : I would like to make a series of \let command from a luatex list.

My MWE is

\def\a{s}

\directlua{
  x = {"b","c"}
  for y in pairs(x) do
    print (y)
    % I would like to \let\<y>\a
  end
}

What I would like it that \directlua produce something like

\let\b\a
\let\c\a

1 Answer 1

10

You can probably mess directly with TeX's hash table from lua but simpler is just to get lua to write out the \let statements.

> \b=macro:
->s.
l.10 \show\b

? 
> \c=macro:
->s.
l.11 \show\c

? 
)
No pages of output

Produced from:

\def\a{s}

\directlua{
  x = {"b","c"}
  for n,y in pairs(x) do
     tex.print("\string\\let\string\\" .. y .. "\string\\a")
  end
}

\show\b
\show\c

\bye
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .