how to fix a runtime error bug!

Hi, I have a current bug in my application I am try to solve. when I build my app to device I sometimes get a Runtime error while testing it and im not sure how to fix it. on the previous corona builds the app worked fine but when i build the same code to device with the new current corona i get this error. However, I am not saying that’s whats causing the issue just noticed it. anyways any help solving this would be AMAZING!

thank you!! 

What is line:  slider.lua line 207?

Rob

Hi Rob, thanks for the reply. I have about 6 .lua files for the project each named for what they do. one of the lua files is name slider. I imagine the runtime error is on line 207 of the code inside the slider.lua file. pics hopefully help. if you need anything else i will be glade to post 

thanks again! 

-- toggleBtns ---------------------------------------------------------------------------------------------------- function toggleBtns( activeBtnId ) local this\_btn = nil local isActive = false for i=1, btns\_sprt.numChildren do this\_btn = btns\_sprt[i] if ( this\_btn ~= nil ) then isActive = ( i == activeBtnId ) this\_btn[1].isVisible = isActive this\_btn[2].isVisible = not isActive end end end

What is line 207?

not sure exactly how to explain it, its a toggle button on the home screen that slides left to right showing different images.when one of the images is selected it brings the user to that image to draw on. The line 207 does the for loop. is the loop set to int. correctly ? im still a newbie:)

i could post a screen shot of the button slider 

thanks for the help.

Try printing this before the loop:

print(btns\_sprt.numChildren)

My guess is that it will print nil. What is btns_sprt exactly? If it’s a table then try using #btns_sprt instead of btns_sprt.numChildren, since the numChildren is specifically for display groups.

thank you for all the help! I did eventually fix the runtime error using the code below .

the app is now on the app store:D now i am in the process of debugging the android runtime errors, thanks again for the help Rob Miracle and Alan.

local function myUnhandledErrorListener( event )

    local iHandledTheError = true

    if iHandledTheError then

        print( “Handling the unhandled error”, event.errorMessage )

    else

        print( “Not handling the unhandled error”, event.errorMessage )

    end

    

    return iHandledTheError

end

Runtime:addEventListener(“unhandledError”, myUnhandledErrorListener)

I need to point out that this function does *not* fix your error, it simply hides it.
Returning true in the “unhandledError” event tells your app to ignore the error and carry on. This is very likely to cause you problems. Not only is it making this error, but also any other errors that may come up. In my opinion the only reason to return true in that function is to log data when debugging errors.

What is line:  slider.lua line 207?

Rob

Hi Rob, thanks for the reply. I have about 6 .lua files for the project each named for what they do. one of the lua files is name slider. I imagine the runtime error is on line 207 of the code inside the slider.lua file. pics hopefully help. if you need anything else i will be glade to post 

thanks again! 

-- toggleBtns ---------------------------------------------------------------------------------------------------- function toggleBtns( activeBtnId ) local this\_btn = nil local isActive = false for i=1, btns\_sprt.numChildren do this\_btn = btns\_sprt[i] if ( this\_btn ~= nil ) then isActive = ( i == activeBtnId ) this\_btn[1].isVisible = isActive this\_btn[2].isVisible = not isActive end end end

What is line 207?

not sure exactly how to explain it, its a toggle button on the home screen that slides left to right showing different images.when one of the images is selected it brings the user to that image to draw on. The line 207 does the for loop. is the loop set to int. correctly ? im still a newbie:)

i could post a screen shot of the button slider 

thanks for the help.

Try printing this before the loop:

print(btns\_sprt.numChildren)

My guess is that it will print nil. What is btns_sprt exactly? If it’s a table then try using #btns_sprt instead of btns_sprt.numChildren, since the numChildren is specifically for display groups.

thank you for all the help! I did eventually fix the runtime error using the code below .

the app is now on the app store:D now i am in the process of debugging the android runtime errors, thanks again for the help Rob Miracle and Alan.

local function myUnhandledErrorListener( event )

    local iHandledTheError = true

    if iHandledTheError then

        print( “Handling the unhandled error”, event.errorMessage )

    else

        print( “Not handling the unhandled error”, event.errorMessage )

    end

    

    return iHandledTheError

end

Runtime:addEventListener(“unhandledError”, myUnhandledErrorListener)

I need to point out that this function does *not* fix your error, it simply hides it.
Returning true in the “unhandledError” event tells your app to ignore the error and carry on. This is very likely to cause you problems. Not only is it making this error, but also any other errors that may come up. In my opinion the only reason to return true in that function is to log data when debugging errors.