Can we get this to be a settable parameter? I’ve been doing a lot of code in XCode, and whenever I come back to Codea, the output pane could really benefit from way less space between print() calls. I’m talkin Terminal style output.
Is this the kind of print output you would like ( the second group ). It looks like a normal print does multiple new lines whereas printing from a table only does 1. I would like the second group to be the normal print. If I want more space between lines, I can add more new lines.
function setup()
tab={}
for z=1,10 do
print(z)
table.insert(tab,z)
end
print(table.concat(tab,"\
"))
end
i always dont know why there’re empty lines the first group
@matkatmusic Unless something changes with the print statement in a future release, the only way to get print like that is to put it into a table and then use the table.concat command to print it. But there will be a gap between seperate table.concat statements. If you take my code above and duplicate the last print statement several times, you’ll see what I’m saying.
overwrite the print command:
local oldPrint = print
function print(...)
oldPrint(table.concat({...}),"\
"))
end
print("Don't","like","a","function?","Replace","it")
Figured it out, so there is no line between calls to “print”:
local oldPrint = print
local consoleOutput = {}
function print(...)
output.clear()
local args={...}
table.insert( consoleOutput, table.concat( args, " " ) )
oldPrint( table.concat(consoleOutput, "\
" ) )
end
function setup()
for z=1,10 do
table.insert(consoleOutput,z)
end
print( "abc ")
print( "12345" )
end
function touched(touch)
print( touch.x, touch.y )
end
The only bug I’ve found is that you can’t do “print( self )”, where self is a class instance
you can apply the tostring
function on all args to ensure there is no bug with print(self)