In addition to tables and figures, I have a bunch of code pieces. Just like follows:
\begin{figure}
\lstinputlisting[
language=C++, breaklines=true,
keywordstyle=\color{blue},
commentstyle=\color{mygreen},
stringstyle=\color{red},
frame=single,
backgroundcolor=\color{gray},
basicstyle=\footnotesize\ttfamily,
caption={Data acquisition code},
label={code:data}]
{codes/data.cpp}
\end{figure}
Those codes do not appear in table of figures or table of contents which is exactly what I want.
Now I want to create a new table of codes \listofcodes similar to \listoffigures. It should create a third table. How do I do that?