Show text on center of screen

How to show text on center of screen ?

I was trying something like this:

local centarX = display.contentWidth / 2  
local centarY = display.contentHeight / 2  
  
local myText = display.newText( "Hello, World", 0, 0, "Helvetica", 40 )  
myText.isVisible = false  
  
myText.x = centarX - (myText.contentWidth / 2)  
myText.y = centarY - (myText.contentHeight / 2)  
myText.isVisible = true  

But with no success [import]uid: 101665 topic_id: 18031 reply_id: 318031[/import]

maybe like this?

[lua]local centarX = display.contentWidth / 2;
local centarY = display.contentHeight / 2;

local myText = display.newText( “Hello, World”, 0, 0, “Helvetica”, 40 )
myText.isVisible = false
myText.x = centarX;
myText.y = centarY;
myText.isVisible = true[/lua]
[import]uid: 90610 topic_id: 18031 reply_id: 68932[/import]

Or this:

local centarX = display.contentWidth / 2  
local centarY = display.contentHeight / 2  
   
local myText = display.newText( "Hello, World", 0, 0, "Helvetica", 40 )  
myText:setReferencePoint(display.CenterReferencePoint)  
myText.x = centarX  
myText.y = centarY  

You don’t need to hide the text before moving it. It all should update in an off screen buffer during the same frame update, so there won’t be any blinking or jumping around.
[import]uid: 19626 topic_id: 18031 reply_id: 68940[/import]

Thanks dingo & robmiracle [import]uid: 101665 topic_id: 18031 reply_id: 69096[/import]