\listfiles
\documentclass[english]{article}

\usepackage{pst-poker}
\usepackage[cleanup={}]{auto-pst-pdf-lua}
\ifpdf
  \usepackage{fontspec}
  \usepackage{dejavu-otf}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{dejavu}
\fi

\usepackage{babel}
\usepackage[a4paper,tmargin=1cm,bmargin=1.5cm,includeheadfoot]{geometry}
\usepackage{listings}
\title{\texttt{auto-pst-pdf-lua}, v. 0.03\\ using Lua\LaTeX\ with PSTricks}
\author{Herbert Voß}
\begin{document}
\maketitle

The package is based on \texttt{auto-pst-pdf} and uses for the \texttt{latex} run the 
program \texttt{dvilualatex}. The package can have all optional arguments which are
possible for \texttt{auto-pst-pdf}.


\section{The example code}

\lstset{basicstyle=\ttfamily\small,language={[LaTeX]TeX},frame=lrtb}
\begin{lstlisting}
\documentclass{article}
\usepackage{pst-poker}
\usepackage{auto-pst-pdf-lua}
\ifpdf
  \usepackage{fontspec}
  \usepackage{dejavu-otf}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{dejavu}
\fi

\begin{document}

An example for using Luacode: 
$\pi^{\pi}=\directlua{tex.print(math.pi^math.pi)}$

An example for PostScript code:

\bigskip
\begin{postscript}
\As~\Ad~\Ac~\Ah~\crdAs~\crdAd~\crdAc~\crdAh
\end{postscript}
\end{document}
\end{lstlisting}

\section{The output}

And here comes the output when running with \verb|lualatex --shell-escape <file>|:


An example for using Luacode: 
$\pi^{\pi}=\directlua{tex.print(math.pi^math.pi)}$

An example for PostScript code:

\bigskip
\begin{postscript}
\As~\Ad~\Ac~\Ah~\crdAs~\crdAd~\crdAc~\crdAh
\end{postscript}


\section{Caveats}

When running \texttt{dvilualatex} the package \texttt{fontspec} cannot be active. If you
need it, then just just the \texttt{\textbackslash ifpdf} switch:

\begin{verbatim}
\ifpdf
  \usepackage{fontspec}%%    for the lualatex run(s)
  \usepackage{dejavu-otf}
\else
  \usepackage[T1]{fontenc}%  for the dvilualatex run
  \usepackage[utf8]{inputenc}
  \usepackage{dejavu}
\fi
\end{verbatim}



\end{document}