Console output doesn't print new line

Hi guys,

Somehow when I tried to print several output to the console using multiple "print" function, the new line doesn't registered after the corona's "copyright (c) ..." output, instead the console just print the output horizontally.

For example when I compiled this script :

1
2
3
4
5
6
7
8
9
local function onTouch(e)
  print (string.format('%q', 'x \n new line'))
end
 
for i = 1, 2 do
  print("test"..i)
end
 
Runtime:addEventListener("touch", onTouch)

%q will put the string in quotes

try %s or

am assuming x is some number, either if it was string...
print ( x .. "\n");

.. is concat

look at http://lua-users.org/wiki/StringLibraryTutorial

Hi Carlos,

Thanks for the reply :) I modified the codes into this :

1
2
3
4
5
6
7
8
9
10
11
-- main.lua
local function onTouch(e)
  -- print (string.format('%s', 'x \n new line')) same result
  print ( "test" .. "\n");
end
 
for i = 1, 2 do
  print("f" .. i)
end
 
Runtime:addEventListener("touch", onTouch)

am actually on a chrome laptop so i can test this but try

"\r\n"

instead of \n

realized u r in windows....

if persist will try tomorrow won win7

I found out that the bug only appeared when I called the simulator via IntelliJ's External Tools. When I run the codes by calling the simulator directly from the window's explorer, it's working perfectly.

Sorry for the trouble, thanks anyway for the replies :)

views:1610 update:2011/10/10 9:00:20
corona forums © 2003-2011