TLDR: LuaTeX is to LuaLaTeX what PlainTeX is to LaTeX (or, these days, pdfLaTeX). To compile your test document, you need LuaLateX, not LuaTeX.
The first line of the log file that's produced when I compile your test document on my TeX system (MacTeX2021, w/ all updates applied) looks like this:
... pdfTeX (aka PlainTeX): This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2022/dev) (preloaded format=pdftex 2021.7.29)
... pdfLaTeX (aka LaTeX): This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2022/dev) (preloaded format=pdflatex 2021.9.22)
... LuaTeX: This is LuaTeX, Version 1.13.2 (TeX Live 2021) (format=luatex)
... LuaLaTeX: This is LuaHBTeX, Version 1.13.2 (TeX Live 2021) (format=lualatex)
... XeTeX: This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xetex 2021.9.22)
... XeLaTeX: This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xelatex 2021.9.22)
If the 'preloaded format' isn't either pdflatex, lualatex, or xelatex, your test program won't compile. In fact, the test program will crash on the very first instruction, viz., \documentclass
. That's precisely what you report in your query. (Actually, you claim that compilation crashes on \newcommand{\example}{1}
. A closer check, though, will reveal that LuateX crashes on \documentclass
.)
Moral of the story? Be care to select an appropriate combination of TeX engine and format before trying to compile the document.
lualatex
with a latex document.