How to convert Table Data value into a String?

Hi

I have Data entries as per the coffee scroll list example but want the images themselves to be buttons.

so I have

[lua]data[6] = {}
data[6].title = “Americano”
data[6].subtitle = “Espresso with hot water”
data[6].image = “coffee6.png”

local redbutton = display.newImage (“redbutton.png”)
redbutton.x = 400
redbutton.y = 100
g:insert(redbutton)

redbutton:addEventListener( ‘touch’, function( e )
if e.phase == “ended” then
print “hi”
Reward.text = tostring(tr[1])
director:changeScene (“screen1”)
end
end)

I’d want the redButton instead to be data[6].image so when I press data[6].image, then it does the changeScene.

Any ideas? [import]uid: 43191 topic_id: 8457 reply_id: 308457[/import]

meant to do “/lua”

sorry ! [import]uid: 43191 topic_id: 8457 reply_id: 30288[/import]

When you write “local redbutton = whatever” instead write “data[6].image = whatever” and then use data[6].image instead of redbutton. [import]uid: 12108 topic_id: 8457 reply_id: 30299[/import]

Hi

That doesn’t work :frowning:

[lua]data[6] = {}
data[6].title = “Americano”
data[6].subtitle = “Espresso with hot water”
data[6].image = “coffee6.png”
local data[6].image = display.newImage (“coffee6.png”)
data[6].image.x = 400
data[6].image.y = 100
screenpage:insert(data[6].image)

data[6].image:addEventListener( ‘touch’, function( e )
if e.phase == “ended” then
print “hi”
screenpage:removeSelf()
director:changeScene (“screen1”)[/lua]

it doesnt seem to like the [] symbols [import]uid: 43191 topic_id: 8457 reply_id: 30306[/import]

You have two data[6].image !
One global and one local. [import]uid: 42078 topic_id: 8457 reply_id: 30322[/import]