diff --git a/doc/lua-reference-guide.tex b/doc/lua-reference-guide.tex index 49979e8b7..39caa030e 100755 --- a/doc/lua-reference-guide.tex +++ b/doc/lua-reference-guide.tex @@ -15,6 +15,8 @@ \usepackage{enumitem} \usepackage[parfill]{parskip} \usepackage{fancyhdr} +\usepackage{calc} +\usepackage{ifthen} \setlength{\parskip}{\baselineskip} @@ -300,5 +302,39 @@ The \textbf{run} function is the function that is periodically called for the en \bottomrule \end{longtable} +\subsubsection{Macro Test} + +\newcounter{parameters} +\newcounter{returns} + +\newenvironment{funcdef}[0] +{\setcounter{parameters}{0}\setcounter{returns}{0} +\newcommand{\prototype}[1]{\textbf{Prototype} & \multicolumn{2}{l} {\texttt{##1}}} +\newcommand{\parameter}[2]{\ifthenelse{\value{parameters}=0}{\\\midrule\textbf{Parameters}}{\\}\stepcounter{parameters}& \texttt{##1} & ##2} +\newcommand{\return}[2]{\ifthenelse{\value{returns}=0}{\\\midrule\textbf{Returns}}{\\}\stepcounter{returns}& ##1 & ##2} +\begin{longtable}{p{3cm}p{3cm}p{\dimexpr\columnwidth-6cm-6\tabcolsep\relax}} +\toprule} +{\\\bottomrule +\end{longtable}} + +\begin{funcdef} +\prototype{local ([first input, [second input], ...])} +\parameter{<>}{zero or more input values, their names are arbitrary, their meaning and order is defined by the input table} +\parameter{none}{test} +\parameter{none}{test} +\return{none}{[text...]} +\return{none}{[text...]} +\return{none}{[text...]} +\return{none} +\end{funcdef} + +\begin{funcdef} +\prototype{playNumber(number, unit, att)} +\parameter{number}{(integer)} +\parameter{unit}{(integer)} +\parameter{att}{(integer)} +\return{nil} +\end{funcdef} + \end{document}