main.Lua Issue: Crash in Device Build

The crash report output is telling me the problem is the gotScene in my main lua which goes to my menu screen.  Am I missing something from my main.lua?   I’m perplexed because it works fine in the simulator.  

Thanks,  Lori

My main Lua:


– main.lua


local centerX = display.contentCenterX

local centerY = display.contentCenterY

local _W = display.contentWidth

local _H = display.contentHeight

display.setStatusBar( display.HiddenStatusBar )

local composer = require “composer”

composer.gotoScene(“menu”, “fade”, 1000)

The Device Output telling me:

25 14:10:45 Loris-IPAD Ball Buddy 1.0[406] <Warning>:  Runtime error

loop or previous error loading module 'menu’

stack traceback:

[C]: in function ‘error’

?: in function ‘gotoScene’

/Users/owner/Desktop/Ball Buddy 1.0/main.lua:22: in main chunk

Apr 25 14:10:45 Loris-IPAD Ball Buddy 1.0[406] <Warning>: Runtime Error: Runtime error: loop or previous error loading module ‘menu’

stack traceback:

[C]: in function ‘error’

?: in function ‘gotoScene’

/Users/owner/Desktop/Ball Buddy 1.0/main.lua:22: in main chunk

Apr 25 14:10:45 Loris-IPAD locationd[59] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0

Apr 25 14:10:45 Loris-IPAD locationd[59] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0

Apr 25 14:10:50 Loris-IPAD locationd[59] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0

@Lori,

OK.  You’ve got two basic possibilities here:

  1. You’ve got a require loop.  i.e. File 1 requires File 2 and File 2 requires File 1.  Not likely however, as you would get an error in the simulator.

  2. You’ve got an error in a scene file you’re trying to load with composer (you’re not using storyboard right?) - Most likely.

If it is #2, and if you’re not using the latest Corona build (2015.2625 or later), you may not be able to get a meaningful error.

Try this.

A. Build your project with 2015.2625 or later.

B. Add this code to the top of main.lua:

local function myUnhandledErrorListener( event ) native.showAlert( "Caught error", event.errorMessage ) return true end Runtime:addEventListener("unhandledError", myUnhandledErrorListener)

This code may capture some errors and show them in a popup/dialog box.  (Don’t keep in code for production build, just for debugging.).

Note: There were some recent builds that didn’t do a good job of reporting error details in scenarios like this.  That is why I’m suggesting that you get and build with the latest release.

When I go to download Corona it says it is version 2014.2511.    Is there someplace special I go to get special versions?   

and THANK YOU

Lori

I found my way to daily builds and found three files.  I’ll download those.

Thanks

Lori

Downloaded the latest Corona build (2015.2625) and added the code to the tope of my main.lua.  And now, it came back with that error in the Corona Simulator.

​Could the require issue be in any of the modules or would it be in the “menu” module referenced?

I’ll have to comb through the code some more.

Thanks

On line 22 of main.lua, which scene are you trying to open?  

That scene has an error or one of the files loaded by that scene has an error.

Thank you so much for your help.   It now works.  On my menu.la I required main.lua.  Once I took that out and downloaded the latest daily build, it downloaded to my IPAD.   I must say this is SOOoooo cool to actually see all the hard work on a device.   Almost surreal.  I know I have a lot of work left to do but today is a good day and a great feeling.

I wish I could return the favor and help you out with issues you have but I’m such a newby compared to you…but let me know if I can be of assistance to you.  You are always so very helpful.

Thanks,

Lori

I’m glad you’ve got it up and running.  Congrats!

@Lori,

OK.  You’ve got two basic possibilities here:

  1. You’ve got a require loop.  i.e. File 1 requires File 2 and File 2 requires File 1.  Not likely however, as you would get an error in the simulator.

  2. You’ve got an error in a scene file you’re trying to load with composer (you’re not using storyboard right?) - Most likely.

If it is #2, and if you’re not using the latest Corona build (2015.2625 or later), you may not be able to get a meaningful error.

Try this.

A. Build your project with 2015.2625 or later.

B. Add this code to the top of main.lua:

local function myUnhandledErrorListener( event ) native.showAlert( "Caught error", event.errorMessage ) return true end Runtime:addEventListener("unhandledError", myUnhandledErrorListener)

This code may capture some errors and show them in a popup/dialog box.  (Don’t keep in code for production build, just for debugging.).

Note: There were some recent builds that didn’t do a good job of reporting error details in scenarios like this.  That is why I’m suggesting that you get and build with the latest release.

When I go to download Corona it says it is version 2014.2511.    Is there someplace special I go to get special versions?   

and THANK YOU

Lori

I found my way to daily builds and found three files.  I’ll download those.

Thanks

Lori

Downloaded the latest Corona build (2015.2625) and added the code to the tope of my main.lua.  And now, it came back with that error in the Corona Simulator.

​Could the require issue be in any of the modules or would it be in the “menu” module referenced?

I’ll have to comb through the code some more.

Thanks

On line 22 of main.lua, which scene are you trying to open?  

That scene has an error or one of the files loaded by that scene has an error.

Thank you so much for your help.   It now works.  On my menu.la I required main.lua.  Once I took that out and downloaded the latest daily build, it downloaded to my IPAD.   I must say this is SOOoooo cool to actually see all the hard work on a device.   Almost surreal.  I know I have a lot of work left to do but today is a good day and a great feeling.

I wish I could return the favor and help you out with issues you have but I’m such a newby compared to you…but let me know if I can be of assistance to you.  You are always so very helpful.

Thanks,

Lori

I’m glad you’ve got it up and running.  Congrats!