Thank you all for your replies,
I have created a working function to do this.
Here’s the code if someone is also looking for this:
function writeTitleLabel(g,x,y,txt, maxwidth)
local title = display.newText( txt, 0, 0, native.systemFontBold, 13*2 )
title:setTextColor(0,0,0)
g:insert(title)
title.y = y
title.xScale = 0.5
title.yScale = 0.5
if maxwidth and title.width > maxwidth then
local aantal = 1
while true do
title.text = string.sub(txt, 0,aantal) … “…”
if(title.contentWidth >= maxwidth) then
break
elseif(aantal >= string.len(txt)) then
break
end
aantal = aantal + 1
end
end
title.x = title.contentWidth * 0.5 + x
end [import]uid: 13464 topic_id: 7792 reply_id: 27828[/import]