I've got some code, which is mainly based on the solution of this:
Other question I asked
The code looks like this and it works so far, except for the \\-stuff:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{environ}
\usepackage{etoolbox}
%%Environments
%Liederbuchumgebung
\newenvironment{Liederbuch}[1]
{\def\liederbuchtmp{#1}\csgdef{LH#1}##1##2{\csuse{lied;#1;##1;##2}}}
{}
%Liedumgebung
\NewEnviron{Lied}[2]{\csxdef{lied;\liederbuchtmp;#1;#2}{\BODY}}
%Forward to Environments
\newcommand*\LHsong[3][n]{\csuse{lied;#2;#1;#3}}
%use of Liederbuchenv.
\begin{Liederbuch}{Test}
%use of Liederbuchenv.
\begin{Lied}{t}{1}
%content begins here.
Lied Nummer 1, Format t
%Problem occurs here. If you delete the \\ it seems to throw a exhaustive expansion error (which I don't understand)
Hänschen klein, %\\
ging allein %\linebreak
in die weite Welt hinein. %\newline
Stock und Hut,
steht im gut.
Ist gar wohlgemut.
\end{Lied}
\begin{Lied}{nt}{2}
Lied Nummer 2, Format nt
\end{Lied}
\begin{Lied}{n}{336}
Lied Nummer 336, Format n
\end{Lied}
\end{Liederbuch}
\begin{document}
\LHsong[t]{Test}{1}
\end{document}
How can I get \\ to work?
\csdef, it does't work, because it's out of scope. If I use\csgdefor\global\csdefI get an error, saying, it doesn't know\BODY. – MaestroGlanz May 03 '16 at 18:46