main.lua:
local textoptions =
{
text = "redhint",
x = display.contentWidth * 0.5,
y = display.contentHeight * 0.5,
width = display.contentWidth - 150,
-- font = native.systemFont,
font = "fontfile.ttf",
fontSize = nil, --makes it to system's default font size
align = "center" -- Alignment parameter
}
local myText = display.newText( textoptions )
myText:setFillColor( 255, 0, 0 )
local function show(level)
if (level == 0)
then
myText:setFillColor( rgb of color )
myText.text = "text"
elseif (level == 1)
then
myText:setFillColor( rgb of color )
myText.text = "text "
elseif (level == 2)
then
myText:setFillColor( rgb of color )
myText.text = "new text"
end
end
Error while running:
main.lua:33: ')' expected near 'of'
How can I fix this? Single-line text creation isn’t preferred due to limitations. There seems to be a problem with the myText.text
.
Thank You!