# Compilation error with LuaLaTeX

I try to compile this code without success.

\documentclass[a4paper,12pt]{article}
\usepackage[upright]{fourier}
\usepackage[no-math]{fontspec}
\begin{document}
\begin{luacode*}
tex.print("\\begin{tabular}{c|c}")
tex.print("x & y \\\\\\hline")
for i=-1,5,1.0 do
tex.print(..i "&" ..-i^2 + 5*i - 8 "\\\\\\hline")
end
tex.print("\\end{tabular}")
\end{luacode*}
\end{document}


The compilation returns the following message :

! LuaTeX error [string "\directlua "]:4: unexpected symbol near '..'.
\luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }

l.13 \end{luacode*}

?

-
If my answer solves your problem, you might consider accepting it. This way future users see immediately that they can "trust" the accepted answer. –  topskip Aug 20 '13 at 20:25
And the error is? –  Martin Schröder Aug 21 '13 at 22:00

You have it almost correct:

\documentclass[a4paper,12pt]{article}
\usepackage[upright]{fourier}
\usepackage[no-math]{fontspec}

\begin{document}
\begin{luacode*}
tex.print("\\begin{tabular}{c|c}")
tex.print("x & y \\\\\\hline")
for i=-1,5 do
tex.print(i .. "&" ..-i^2 + 5*i - 8 .. "\\\\\\hline")
end
tex.print("\\end{tabular}")
\end{luacode*}
\end{document}


You have the .. in the wrong place. (And a missing document environment, but that is obvious :-))

-
@topskipI actually forgot \begin{document}, it is a blunder ! For bad positioning .., this is my first code with Lua. How to replace tex.print("x & y \\\\\\hline") by tex.print("$x$ & $f(x)$ \\\\\\hline") ? –  Fabrice Aug 20 '13 at 14:05
@Fabrice Replacing the line works just fine. I don't see a problem in the code. –  topskip Aug 20 '13 at 18:11