Here is my code to find Greatest Common Divisor of two positive integers.
\documentclass{article}
\usepackage{luacode}
\begin{luacode}
function gcd(a,b)
if b ~= 0 then
return gcd(b, a % b)
else
return math.abs(a)
end
end
\end{luacode}
\newcommand\findgcd[2]{\directlua{tex.sprint(gcd(#1,#2))}}
\begin{document}
\findgcd{5,10}
\end{document}
It throws error. The expected output is simply gcd of 5 and 10. Is % sign in lua code causing the error?