lua-users home
lua-l archive

Re: redirecting the output of print()

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


print is not part of the io library and so does not know about io.output.
You can redefine print to use the io library:
function print(...)
 local a=table.pack(...)
 local t=""
 for i=1,a.n do
 io.write(t,tostring(a[i]))
 t="\t"
 end
 io.write("\n")
end

AltStyle によって変換されたページ (->オリジナル) /