Print large macro block from Lua to TeX
I need to escape a string in Lua code in LuaLaTeX. I'm trying to print a string but LaTeX seems to hiccup on some special characters. I know I can call
\luatexluaescapestring from inside text but I need an equivalent function in Lua that will either remove the offending characters or escape them properly.