I have a text field in which when a person types in a number from 1-200, a scene will come up. Each 200 scenes are different. The code uses a button and 200 if/else statements. However only 61 scenes work and none of the other 149 scenes.
In the log it says:
22:57:37.988 error loading module ‘view3’ from file ‘C:\Users\cornt\Documents\Corona Projects\APP1\view3.lua’:
22:57:37.988 C:\Users\cornt\Documents\Corona Projects\APP1\view3.lua:364: function at line 239 has more than 60 upvalues
22:57:37.988 stack traceback:
22:57:37.988 [C]: in function ‘error’
22:57:37.988 ?: in function ‘gotoScene’
22:57:37.988 C:\Users\cornt\Documents\Corona Projects\APP1\view2.lua:49: in function ‘?’
22:57:37.988 ?: in function <?:182>
23:07:29.834
What is wrong?
Is it because you can only do 60 if statements.
I do not want to Share my code because it would be too long and someone would take me code.
However here is the basic idea of my code:
--Textbox Variable local boxField --Text Listener local function textListener( event ) if ( event.phase == "began" ) then -- User begins editing "numericField" end end --Creating the textbox boxField = native.newTextField( background.x, background.y, 180, 30 ) boxField.inputType = "number" boxField:addEventListener( "userInput", textListener ) --Search Button local searchBn = display.newImageRect("name.png", 200,50) searchBn.x = display.contentCenterX searchBn.y =display.contentCenterY+50 --Scene Creation(Since there is no space for 200 lines of composer lines, I will do 3) local function 1( event ) composer.gotoScene( "1" ) end local function 2( event ) composer.gotoScene( "2" ) end local function 3( event ) composer.gotoScene( "3" ) end --Search function creation local function searchFunction() --if statement(Since there is no space for 200 lines of if statements, I will do 3) if boxField.text == "1" then 1() elseif boxField.text == "2" then 2() elseif boxField.text == "3" then 3() end end searchBn:addEventListener("tap",searchFunction) --That is the basic idea of my code except instead of 3 lines of if/else/composer code, it is 200