# [luatex] Lua long strings

Dirk Laurie dpl at sun.ac.za
Fri May 6 11:51:41 CEST 2011

I'd like to define a Latex environment "verbatimlua" that allows:

\begin{verbatimlua}
s = [[
A long Lua string containing special characters like \ and %,
with end-of-lines respected too.
]]
print(s) -- all of s on the screen and in the log file
tex.print(string.format("%.5f",math.pi))) -- 3.14159 in the TeX output
\end{verbatimlua}

I.e. it works like "verbatim" but the contents is passed to the Lua
engine instead.  Same as putting it in a file xxx.lua and saying
\directlua{ dofile"xxx" }

I can't possibly be the first person who has tried and failed to do this.
Maybe someone has tried and succeeded?

Dirk