ok i did what you said. i added a if statement and changed it back to widget.newbutton().
this is what i have. i got it to print what only one thing. it stay up on the screen but when i press the button nothing happens. but it does have a limit on how many presses it has since i do have table.remove(list_of_things_to_say, idx). it will do it six times and on the console part. it will show a sequence of numbers counting down from six to one. since i do have a total of six words. but after that it will get a error. also the words are not changing at all. it will stay on alpha. nothing is changing.
[lua]
local widget = require (“widget”)
----table chart
local list_of_things_to_say = { “alpha”, “beta”, “charlie”, “delta”, “ecko”, “Foxtrot”, }
-----display text
local myText = display.newText( list_of_things_to_say[1], 100, 200, native.systemFont, 16 )
----button
local rndmtxt = widget.newButton
{
left = 160,
top = 350,
id = “newcardbtn”,
label = “New question?”,
onEvent = onObjectTouch
}
-----button funtion/event listner
local function onObjectTouch( event )
if event.phase == “began” then
print (#list_of_things_to_say)
list_of_things_to_say.text = math.random(1, #list_of_things_to_say)
table.remove(list_of_things_to_say, idx)
end
return true
end
rndmtxt:addEventListener( “touch”, onObjectTouch )
[/lua]