I wanted to print something from luacode, and have it show up on its own line in Latex, not on the same line. The question here, which is similar, but uses strings, but I am not printing strings from lua. A simple example will explain:
\documentclass[11pt]{scrartcl}
\IfFileExists{luatex85.sty}
{
\usepackage{luatex85}
}{}
\usepackage{luacode}
\begin{luacode*}
function foo(list)
tex.print(type(list))
local i = 0
for _ in pairs(list) do
i = i + 1
tex.print(list[i])
end
end
\end{luacode*}
\begin{document}
\directlua{foo({1,2,3,4})}
\end{document}
The above produces all the output on same line.

Even though documentation clearly says it will insert new line

Ok, but it says strings in the above, and what I am sending from Lua to Latex is not string. So is one really supposed to convert everything to strings before passing stuff back to Latex from lua? I found I can get new line if I do this:
\documentclass[11pt]{scrartcl}
\IfFileExists{luatex85.sty}
{
\usepackage{luatex85}
}{}
\usepackage{luacode}
\begin{luacode*}
function foo(list)
tex.print({type(list),"\\\\"})
local i = 0
for _ in pairs(list) do
i = i + 1
tex.print({list[i],"\\\\"})
end
end
\end{luacode*}
\begin{document}
\directlua{foo({1,2,3,4})}
\end{document}
Which gives what I wanted

but I really do not want to write the above, I simply wanted to write tex.print(list[i]) and have it show on its own line in Latex. There is function called texio.write_nl but this is for logging and not what I wanted.
TL 2016
Update:
WHen I run this:
\documentclass[11pt]{scrartcl}
\IfFileExists{luatex85.sty}
{
\usepackage{luatex85}
}
{}
\usepackage{luacode}
\begin{luacode*}
function foo(list)
tex.print(type(list))
tex.print("\\newline")
tex.print(type(list[1]))
tex.print("\\newline")
local i = 0
for _ in pairs(list) do
i = i + 1
tex.print(list[i])
end
end
\end{luacode*}
\begin{document}
\directlua{foo({1,2,3,4})}
\end{document}
The output is

In in Lua land, the type is number and table. But if the input to tex.print is supposed to be string, how is it converted to string?
reference: http://wiki.luatex.org/index.php/Writing_Lua_in_TeX