Debugger Support?
-
Hi Guys,
is there a way how to debug a function? Mainly inspect variables at certain point? I tried to create a global variable into which I tried to assign values from the function but they seem to be strictly in a function local-scope, I even tried the global "keyword" which didn't produce any syntax errror but didn't have any effect.
Thanks for any help.
Cheers,
Michal -
I simply use "print" to get the variable status each time every update.
-
JonBoy uses a really handy debug function in his programs. Here's an example:
function breakPoint( info ) press = false while !press loop j = controls(0) if j.x then press = true endif clear() print( "Breakpoint: ", info ) print( "Press X to continue" ) update() repeat sleep( 0.2 ) return void
You can use this function wherever you like in your program. Simply pass it the value you want to check at the point you want to check it, and you'll get a display of the value at that exact point in the program flow.
I will be working on a debugging tutorial in future updates to get this info into the product formally.
Hope this helps!
-
@Dave That looks like one for the "hints and tips" post!
-
Yes! I'll do another post there.
-
Wow, nice tip. Thanks a lot !
-
Hi @Dave I really like your posted solution, it's really nice and flexible since it displays the variable at any point in time.
Thanks!
-
No problem! Really I can't take the credit as I got it from @Jonboy :)
This function will be added to the tutorials in an update some point in the future.