Help Read Characters from a For Loop

I have the following code:

[lua]for c = 1, wordLength do
local displayWord = display.newText(letter[c], 0, 0, nil, 36)
displayWord.x = _W * .5 + (c * 40) - 150
displayWord.y = _H * .5

function displayWord:touch(e)
if(e.phase == “ended”) then
displayWord.text = newLetter
end
end
displayWord:addEventListener(“touch”, displayWord)
end[/lua]

A little background on the code to see if you can help.

I have created a table called “letter”. I created that by breaking up a string and only putting the letters into it. On that initial string, I also got the length of it (wordLength), which I use in this for loop.

I have a variable called “newLetter” which holds a string (which it is only one letter).

This code all works great. Does exactly what I want it to.

My question is, after I’ve created this loop and made each letter touchable, I’m able to change the letter to be the “newLetter” like I want it to. But I don’t have any way to read the new word that is on the screen.

So I change a letter by touching it. Say the initial word is “FACE” and I have the newLetter “R” and touch the “F” of the word. Now the word says “RACE”.

Is there any way to go through each of those letters in the “displayWord” variable that was run through the loop and make a new string (“RACE” in this case) out of them? That way, I can put the new string in a variable that I can use elsewhere.

Thank you,

–Matt [import]uid: 14084 topic_id: 7164 reply_id: 307164[/import]