From this question: Cannot use \toprule when doing \input inside tabular -- why? I know that everything inside the tabular environment should better be expandable. The MWE below suggests that \InputIfFileExists is not, although the error message is different now:
! Missing \endcsname inserted.
<to be read again>
\def
l.8 \end{tabular}
File main.tex:
\documentclass{standalone}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ll}
\InputIfFileExists{inp.tex}{}{}
\end{tabular}
\end{document}
File inp.tex:
\toprule
a & b \\
c & d \\
\bottomrule
How do I check, in an expandable fashion, if a file exists and input it if it does?
The following question is related: Why is \input not expandable?
This is my first LuaTeX code, so please bear with me. 
