Debugging while incorporating the Director Class

I'm very green at using Corona, that being said, I'm having a really hard time using the director class for the following reason:
I get how to make the calls, and can usually get a bit of progress in switching from my main menu to the game, AND the implementation of the error messages I get in the console are awesome, however I'm making the mistakes, and how do I get the console to display my errors, rather than just the generic

Director Error: failed to load module 'game' please check if the file exists and is correct.

I know I'm breaking it every time, but how do I get the simulator to give me a line number in my code so I'm not guessing, when I'm using the director class?

Do I need to build the whole game state seperately, and at the end of development, incorporate Director?

Ideas, anyone?
TIA

Biffo, you should definitely integrate with Director sooner than later for this precise reason - you can check it along the way. IMHO it's much harder to put your code into Director after the fact, than right out of the gate. You are doing exactly what you need to be doing. As for getting more debugging results you can still run your app via the Corona Terminal and spit out anything you want using print statements...

Like this:

1
    print("Something meaningful to your debugging efforts, variable values, line numbers, whatever")

Hey guys, I'm already working on a better error message and a boolean variable to toggle it on/off.

Thanks,

Ricardo Rauber

Thanks Ricardo! And ty croisened for the idea. I could do that, but I really depend on that console widow telling me what line number, my logic's breaking down at. I don't want to mess with Ricardo's director class, unless I really get it all. BTW Ricardo, I tried a couple of times to donate to you but the redirect from your blog takes me to a spanish paypal that won't accept my password. (It's a bit unnerving entering in payment info on a page I can't read.) Do you want to add a link to an english paypal? I did send 10.00 to ricardorauber@gmail.com, and I truly appreciate your sharing this awesome lib.

Hey Biffo, try changing this on Director:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--====================================================================--
-- TOGGLE DEBUG
--====================================================================--
 
showDebug = true
--showDebug = false
 
--====================================================================--
-- SHOW ERRORS
--====================================================================--
 
local showError = function( errorMessage, debugMessage )
        local message = "Director ERROR: " .. tostring( errorMessage )
        local function onComplete( event )
                print()
                print( "-----------------------" )
                print( message )
                print( "-----------------------" )
                print( debugMessage )
                print( "-----------------------" )
                error()
        end
        --
        if showDebug then
                local alert = native.showAlert( "Director Class - ERROR", message, { "OK" }, onComplete )
        else
                onComplete()
        end
end

Awesome! Thanks Ricardo. I've been building the gamestate seperately to work out the kinks and then incorporating into the scen based version as I get the code semi solid. This should help though. Thanks for the awesome tool!

views:1268 update:2011/10/12 18:33:00
corona forums © 2003-2011