menuData = {"Option 1", "Option 2", "Option 3", "Option 4", "Option 5"} for menuDisp = 1, #menuData do local menuData = display.newText(menuData[menuDisp], 160, 100, 0, 0, "Arial", 45) end
is there something I’m doing wrong or is does this just not work like this. I’m trying to get it to display like this
Main Menu Option 1 Option 2 Option 3 Option 4 Option 5
but it keeps looking like this
http://screencast.com/t/X9UrrgJg
any help would be appreciated
Hi @twilson9182,
You’re correctly iterating through the “menuData” table, but you’re not changing the Y position of the text objects. So, they just overlap each other. Consider adding a Y value multipled by the loop index, like this:
[lua]
local menuData = display.newText(menuData[menuDisp], 160, 100+(menuDisp*50), 0, 0, “Arial”, 45)
[/lua]
Hope this helps,
Brent
Hi @twilson9182,
You’re correctly iterating through the “menuData” table, but you’re not changing the Y position of the text objects. So, they just overlap each other. Consider adding a Y value multipled by the loop index, like this:
[lua]
local menuData = display.newText(menuData[menuDisp], 160, 100+(menuDisp*50), 0, 0, “Arial”, 45)
[/lua]
Hope this helps,
Brent