The following code can be compiled by lualatex (Version beta-0.70.1-2011061410 (rev 4277)) correctly. But if I use \begin{luacode} ... \end{luacode} environment to replace the \luaexec{...} command, errors occur. Is this a bug?
! Extra }, or forgotten \endgroup.
<template> \unskip \hfil }
\hskip \tabcolsep \endtemplate
l.19 \end{luacode}
?
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.19 \end{luacode}
?
! Missing } inserted.
<inserted text>
}
l.19 \end{luacode}
?
! LaTeX Error: \begin{tabular} on input line 8 ended by \end{luacode}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.19 \end{luacode}
? q
Here's an example
\documentclass[]{article}
\usepackage{luacode}
\usepackage[left=1cm,right=1cm]{geometry}
\begin{document}
\begin{center}
\begin{tabular}{lllllllll}
\luaexec{
num=6
for i=1,num do
for j=1,num do
ixj='$'..i..'\\times'..j..'='..i*j..'$';
tex.print(ixj)
if(j<num) then tex.sprint('&') else tex.sprint('\\\\') end
end
end
}
\end{tabular}
\end{center}
\end{document}
