1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 11:29:51 +03:00

Macro added for functions definitions in the Lua LateX document

This commit is contained in:
bsongis 2015-01-06 21:59:17 +01:00
parent dd17eee876
commit 286aa677d0

View file

@ -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 <run\_function\_name>([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}