\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{lua}
function greet()
  print("Hello world!")
end
\end{minted}

\inputminted{lua}{file.lua}
\end{document}

.
