<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello, I'm trying to include a gcd function using lua in a sty file.<br>
Here is the code of euclide.sty :<br>
<br>
<blockquote>\RequirePackage{ifluatex,luacode,luatextra}<br>
\ifluatex<br>
\begin{luacode}<br>
function euclide(a,b)<br>
if a < b then a,b = b,a end<br>
r = a-math.floor(a/b)*b<br>
if r == 0 then tex.print(b) else euclide(b,r) end<br>
end<br>
\end{luacode}<br>
\newcommand{\euclide}[2]{\luaexec{euclide(#1,#2)}}<br>
\fi<br>
</blockquote>
Here is the texfile code :<br>
<br>
<blockquote>\documentclass[10pt,oneside]{article}<br>
\usepackage{euclide}<br>
<br>
\begin{document}<br>
\euclide{435}{630}<br>
\end{document}<br>
</blockquote>
The lualatex compilation give me errors :<br>
<br>
<blockquote>Runaway argument?<br>
! File ended while scanning use of \luacode@grab@lines.<br>
<inserted text> <br>
\par <br>
l.4
<br>
<br>
I suspect you have forgotten a `}', causing me<br>
to read past where you wanted me to stop.<br>
I'll try to recover; but if the error is serious,<br>
you'd better type `E' or `X' now and fix your file.<br>
<br>
<br>
! LaTeX Error: Missing \begin{document}.<br>
</blockquote>
Can somebody tell me what's wrong in my code ?<br>
Thanks, MB.<br>
</body>
</html>