I am trying to pass parameters in an event function. I have a native input function and would like to be able to use it to input to different tables if possible.
I know this is not correct, but conceptually I would like to do something like this:
local function textListener( event, table ) if event.phase == "began" then event.target.text = '' elseif event.phase == "submitted" then text1 = event.target.text native.setKeyboardFocus(nil) table.insert(table, text1) print(table.concat(table, ", ")) end end local function callAhead() textListener(table1) end defaultField = native.newTextField( 10, 50, 180, 23 ) defaultField:addEventListener( "userInput", callAhead)
Am I able to do something like this or am I going to have to create a new textListener function every time I want to input something into a different table?