Hi Everyone,
Sorry If this topic has been covered before…
How do I declare a variable from a user input?
For example with the code below, if the user enters the value of 5 in the text field how do I store it as a variable to be used in a math function?
Forgive me if none of this make sense, I’m very new in this field.
[lua]local function handlerFunction( event )
if ( event.phase == “began” ) then
– user begins editing numericField
print( event.text )
end
end
local numericField = native.newTextField( 150, 150, 220, 36 )
numericField.inputType = “number”
numericField:addEventListener( “userInput”, handlerFunction )[/lua]