You can set any style you want to embed using listings . The predefined Lua language contains all the keywords and related styles, so you can simply change it to suit your needs:

\documentclass{article} \usepackage{listings,xcolor} \lstdefinestyle{lua}{ language=[5.1]Lua, basicstyle=\ttfamily, keywordstyle=\color{magenta}, stringstyle=\color{blue}, commentstyle=\color{black!50} } \begin{document} \begin{lstlisting}[style=lua] -- defines a factorial function function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("enter a number:") a = io.read("*number") -- read a number print(fact(a)) \end{lstlisting} \end{document}
source share