为什么在 Corona SDK 中打印("Hello World!")时没有任何显示

Why is nothing displayed when print("Hello World!") in Corona SDK

为什么我做的时候屏幕上没有任何显示

display.setDefault( "background", 0, 0, 1 )
print("Hello World!")

但是当我这样做时它会显示

display.setDefault( "background", 0, 0, 1 )

local myText = display.newText( "Hello World!", 100, 200, native.systemFont, 16 )
      myText:setFillColor( 1, 0, 0 )

print(myText)

Corona documentation 解释了 print 的作用:

Receives any number of arguments and prints their values to stdout in the Corona Simulator Console, Xcode, ADB, etc. print() is not intended for formatted output, but rather as a quick way to show a value, typically for debugging. For formatted output, use string.format.

这意味着您的第二个 example 可以在没有 print(myText) 语句的情况下工作。