Check if LuaTeX is running
\@empty
is defined in LaTeX, so your test fails. Why don't you use ifluatex.sty
? It will work with plainTeX too,
How about iftex
? it works fine in plain, and gives you some other useful macros.
It is also included in TeXLive.
Here is a more direct answer that uses iftex (see section 3.3):
\usepackage{iftex}
\ifLuaTeX
% ⟨material for LuaTEX⟩
\else
% ⟨material not for LuaTEX⟩
\fi