How to trace this error?

I haven’t run into this with Corona before, and trust me, I’m no stranger to Corona errors :stuck_out_tongue:

Basically I get an error, but no pointer as to where the error is! So the question is, what’s the best tactic to find it?

Error: 

Aug 08 21:28:29.792: ERROR: Runtime error

?:0: attempt to compare number with nil

stack traceback:

?: in function '?'

?: in function '?'

?: in function <?:182>

2017-08-08 21:30:41.175855-0400 Corona Simulator[36784:6623087] Corona Simulator: Goodbye

I know I have an issue as I cascade back through scenes (by design), but not sure where to look really! (This doesn’t happen when you first run it, it occurs when I return to previous scenes)

Debug I’ll try next, but I will confess it doesn’t always handle such long stepping well, it tens to crash the simulator eventually! 
I’ve added many ‘print “you are here”’ statements to try and narrow it down (and they all print still)

Anyhow, I wondered if there was something I could do to try and locate it and thought I’d ask the experts :slight_smile:

Ah, these are always fun (not). I would start by checking for conditional comparisons like ==, <, >, <=, or >= … since the error is flagging a comparison with some number, you might locate it that way.

Brent

If I even knew what Lua file it was it would have been helpful :stuck_out_tongue:

(and the debugger route was a miserable failure as expected)

This should (not) be a fun day… :slight_smile:

First stop, add a bunch of debug “X” to the start of each function, hopefully to identify the where…

If you can locate the file that should make it easier, what file were you editing when you got this? Then, try to remember what you were doing on that file.

Unfortunately it wasn’t an editing mistake. I am building the ‘load the next level’ code, so it’s dropping back through the scenes to reload the next map.

So it’s a variable that probably hasn’t been reset, but there are a lot of them :slight_smile:

It says function ? line 182. Ring a bell?  :frowning:

It’s strange though, usually, when I get that error it points me to a least one or two lines.

It doesn’t actually say line 182 :slight_smile: it says " <?:182>" and as far as I can tell, it’s not line 182. There’s been a boatload of debugs added in the last hour so the lines are changing, but the error are not.  I suspect thats a LUA error, something like function 182 for example.

(I also checked every other module looking for a line 182 :).   )

Then I guess check all the comparison if statements, use find and replace to find them, (but don’t replace them). :slight_smile:

Not bad, 289 of them…

(The great thing with the Corona Xcode editor, is that the Xcode Find functionality is awesome, it shows ALL the modules and the lines AND the line contents. So my plan is to work through the 289 looking for numbers, then debugging each one :slight_smile:

Appreciate your input.

Hmmm, in Atom, my find and replace highlights all of them, and you can choose to bounce back and forth between them. It sounds like your project is kinda big.

I would suspect that’s happening in some compiled code that’s had it’s debugging information stripped. Your Lua code would generate files and line numbers. I suspect it’s probably a plugin that’s getting a nil value passed to it when it’s expecting a number.

It could be in our core somewhere, but we are pretty good about keeping out stack traces around until you actually build.  Have you added or changed calls to a plugin around the time this started happening?

Rob

I didn’t see Robs reply, but he’s right on the money.

It wasn’t a ‘new’ plugin, but more an untested piece of code. It was the Dynamic shader that was causing the failure. (Since I rewrote a lot of the code, I was appalled to see the error back. BUT it was immediately as I added the shader :slight_smile:

So, problem solved, and shader objects destroyed.

So, short answer - these kinds of errors might well come from a plugin you are using.

Ah, these are always fun (not). I would start by checking for conditional comparisons like ==, <, >, <=, or >= … since the error is flagging a comparison with some number, you might locate it that way.

Brent

If I even knew what Lua file it was it would have been helpful :stuck_out_tongue:

(and the debugger route was a miserable failure as expected)

This should (not) be a fun day… :slight_smile:

First stop, add a bunch of debug “X” to the start of each function, hopefully to identify the where…

If you can locate the file that should make it easier, what file were you editing when you got this? Then, try to remember what you were doing on that file.

Unfortunately it wasn’t an editing mistake. I am building the ‘load the next level’ code, so it’s dropping back through the scenes to reload the next map.

So it’s a variable that probably hasn’t been reset, but there are a lot of them :slight_smile:

It says function ? line 182. Ring a bell?  :frowning:

It’s strange though, usually, when I get that error it points me to a least one or two lines.

It doesn’t actually say line 182 :slight_smile: it says " <?:182>" and as far as I can tell, it’s not line 182. There’s been a boatload of debugs added in the last hour so the lines are changing, but the error are not.  I suspect thats a LUA error, something like function 182 for example.

(I also checked every other module looking for a line 182 :).   )

Then I guess check all the comparison if statements, use find and replace to find them, (but don’t replace them). :slight_smile:

Not bad, 289 of them…

(The great thing with the Corona Xcode editor, is that the Xcode Find functionality is awesome, it shows ALL the modules and the lines AND the line contents. So my plan is to work through the 289 looking for numbers, then debugging each one :slight_smile:

Appreciate your input.