\documentclass{standalone}
\usepackage{lt3luabridge}
\luabridgeExecute{x = 1 -- this will have no effect due to sandboxing}
\begin{document}
$ 1 + 2 = \luabridgeExecute{if true then print(1 + 2) end} $
\end{document}