Checking if string exists.

Quick rundown;

Making Phone
Has Key Pad
Screen
Text Entry

When I press a number, what I would like for it to do is put the corresponding number in the text box, and if I press another it will push the current string aside and place in the one you just pressed.
How would I go about doing this?
Sorry If I made that sound 1000x more confusing then I should of.
Basically want it working like a calculator input.

Thank you in advance.

[lua]
local string = “”

function AddNumber(mynumber)
string = tostring(mynumber)…string
end
[/lua]

Also, questions go in questions form.