Corona IDE

Okay I’ve made progress. I see stuff in the stack window but none of my watch variables are showing anything other than “Value”. I got it to break at a break point, but when I tried to step over things, I got this in the console window:

Couldn't activate file '/Users/rmiracle/Projects/Technolio/TP\_Series/TP-Shapes-V2/=?' for debugging; continuing without it.  
Debugging suspended at =?:0 (couldn't activate the file).  

[import]uid: 199310 topic_id: 34354 reply_id: 137557[/import]

Rob, the first thing (watch window doesn’t evaluate expressions) is a limitation of Corona simulator on OSX. There is a difference between the debug mode on Windows (which allows loadstring that debugger is using for remote console and watches) and on OSX (where loadstring is not available).

The second is the strange path that is being reported by Corona in some situations (the debugger just reports whatever path the engine tells it). ZBS still stops the application, so that you can set breakpoints and step through it, but it also tells you that it couldn’t find the location in the source code.

You can continue stepping through the code and in most cases the control will go back to the Lua code you are debugging; I’m working on an improvement that may put you there sooner if possible. [import]uid: 195109 topic_id: 34354 reply_id: 137593[/import]

@Magenda

> 1) The print output is not visible when Corona is selected as the Lua Interpreter. Is this on purpose or just a bug?

The simulator on Windows doesn’t redirect input/output as a “normal” application does (you can see it yourself; try running "Corona Simulator.exe" 1\>1 2\>2 and the output still goes to the console window). I can add an option to show the console window, but that’s probably all I can do.

When you run it under the debugger though, you will see the output in the Output window. Just add require('mobdebug').start() to your script, and the print output will be redirected to the output window.

> 2) Do you plan to add links, or even better live references, to Corona Documentation? You can see this feature in CodeHelper (Corona Complete) and other editors. It is super convenient to have the docs in your fingers!

Not sure; I couldn’t find a good source of Corona API documentation.

> 3) A Functions Navigator, as in IntelliJ and other editors, would be more than awesome. It helps much more than the Jump to… list that SL2 and other simpler editors have.

Do you mean the project tree that displays list of functions for every file and you can click on those to jump to the function definition? I don’t plan to have it in this format, but you will have a way to navigate functions (and other symbols) across your project files.

> In general, your editor is truly nice. Congrats!

Thank you; glad you enjoy it.

Paul. [import]uid: 195109 topic_id: 34354 reply_id: 137594[/import]

@Aidin, I took another stub at it and managed to make it work. You need to structure your code in a particular way to work around one Corona issue, but other than that it seems to be working on simple scripts I tried it with.

I’ll post details in a blog post in a day or two… [import]uid: 195109 topic_id: 34354 reply_id: 137595[/import]

@ paulclinger6

  1. I run ZBS under OSX 10.8, not windows. The “require” thing at the first row in main.lua didn’t help. Neither starting the project with F5. No logs either way…

  2. There must be a good source somewhere, since other editors generate the doc links and show the content depending what you are coding. Maybe Corona Team should help you on this!

  3. I can live without this.

Thanks for answering! [import]uid: 7356 topic_id: 34354 reply_id: 137608[/import]

@Magenda,

> The “require” thing at the first row in main.lua didn’t help. Neither starting the project with F5. No logs either way…

I’ve seen the output being buffered on OSX. You may want to add io.stdout:setvbuf('no') to your script to turn the output buffering off.

Paul. [import]uid: 195109 topic_id: 34354 reply_id: 137657[/import]

@ paulclinger6

That made the trick!
Thanks a lot. [import]uid: 7356 topic_id: 34354 reply_id: 137667[/import]

@paul:

I’m enjoying ZeroBrane very much and I’m coding with Corona SDK. A question though, when I stop at some breakpoint, is there anyway to see variables’ values in a better way? Currently I can see some crude “__class{ __index” thing which isn’t descriptive and neat and really cannot understand it. Worse is it’s not even complete and just watch window just shows some parts of the table’s confings.

It works better when you want to watch variables but most objects are tables in Corona and I’m afraid with the way ZeroBrane displays them, it’s not so much use to me.

Please help me on this. [import]uid: 206803 topic_id: 34354 reply_id: 137915[/import]

Thank you for the feedback; I’m glad you are enjoying the IDE. You have several ways to see values of variables and expressions:

  1. The Stack window; it will show all local values and upvalues and will allow you to expand tables.
  2. The Watch window; you can specify any expression you want and it will be evaluated after each debugger step. The results are shown as one pretty-printed line without a way to expand it.
  3. The tooltip; just mouse over a variable (or select an expression and mouse over it) to see the value.
  4. The console; you can execute any expression in the console and the result will be pretty printed for you. You can also do ‘=expression’ to pretty print the results in the block form.

Some of the data structures that Corona is using are quite complex and include references to other data structures. If you are using the Watch window you can simplify the expression to only show those elements you are interested in. If this still doesn’t work, can you send me the screenshot or a code fragment I can test it on? Thank you. Paul. [import]uid: 195109 topic_id: 34354 reply_id: 137922[/import]

@Magenda, @Aidin, I posted a screencast and detailed description for Corona SDK debugging and live-coding with ZeroBrane Studio: http://notebook.kulchenko.com/zerobrane/debugging-and-live-coding-with-corona-sdk-applications-and-zerobrane-studio. You need to get v0.35 of ZeroBrane Studio (http://studio.zerobrane.com/).

Please let me know if you have any questions or run into any issues with it. Paul. [import]uid: 195109 topic_id: 34354 reply_id: 142447[/import]

Nice update! [import]uid: 206803 topic_id: 34354 reply_id: 142533[/import]

It is a pity that Corona doesn’t have debugger it deserves. Currently, it is much faster to debug code by using print() function that to use Corona’s own debugger :frowning:

ZB Studio is great IDE. I am using it for two months and it saved me hours of debugging. You can stop at any time, check the status of your app, see what is wrong, change it…
It is light, fast and stable.

Difference between using print() for debugging and ZB debugger is like comparing anamnesis and MR.
ZB doesn’t have fancy stuff like other IDE’s like code snippets, goto definition and many more. It is quite minimal (almost zen) editor with auto-complete feature. But it can analyze your code, find errors before you even start simulator. You can watch only variables you want to watch. If you want more, you can simply hover cursor above variable in your code and ZB will pop its value. Cool thing is that if you have something like table of values: blabla.x, you can hover above blabla and get info about that table but if you move cursor above x you will get value of x. (keep in mind that you must set the breakpoints first)

There is console where you can test your code before entering it in the editor.
Another cool thing is =print function which prints table in user friendly way…

It definitely deserves an attention and, maybe, its own forum folder because author is very productive and open for suggestions. Maybe we all can help him build an excellent Corona editor… [import]uid: 101952 topic_id: 34354 reply_id: 142604[/import]

I just downloaded it and managed to change theme but how do I set the terminal to black with white text while still having the theme colors in the editor? [import]uid: 65840 topic_id: 34354 reply_id: 142613[/import]

@cindy.h1986, if by “terminal”, you mean the console and the output window, the easiest way is to add something like this to cfg/user.lua: “stylesoutshell.text = {fg = {200, 200, 200}, bg = {0, 0, 0}}”; however you will probably want to have matching colors for selection, markers and other elements, so you can simply pick a color theme that is close to what you need. For example, you can use:

local G = …
stylesoutshell = G.loadfile(‘cfg/tomorrow.lua’)(‘TomorrowNightBright’)

You can see all the pre-packaged themes and how they map to different colors in cfg/tomorrow.lua. [import]uid: 195109 topic_id: 34354 reply_id: 142653[/import]

> ZB Studio is great IDE. I am using it for two months and it saved me hours of debugging. You can stop at any time, check the status of your app, see what is wrong, change it… It is light, fast and stable.

Hi Srdjan, Thank you for the feedback! ZBS indeed strives to be a simple minimalistic IDE, but some of the “fancy” features are being worked on; please keep the comments coming…

Paul. [import]uid: 195109 topic_id: 34354 reply_id: 142655[/import]

@Magenda, @Aidin, I posted a screencast and detailed description for Corona SDK debugging and live-coding with ZeroBrane Studio: http://notebook.kulchenko.com/zerobrane/debugging-and-live-coding-with-corona-sdk-applications-and-zerobrane-studio. You need to get v0.35 of ZeroBrane Studio (http://studio.zerobrane.com/).

Please let me know if you have any questions or run into any issues with it. Paul. [import]uid: 195109 topic_id: 34354 reply_id: 142447[/import]

Nice update! [import]uid: 206803 topic_id: 34354 reply_id: 142533[/import]

It is a pity that Corona doesn’t have debugger it deserves. Currently, it is much faster to debug code by using print() function that to use Corona’s own debugger :frowning:

ZB Studio is great IDE. I am using it for two months and it saved me hours of debugging. You can stop at any time, check the status of your app, see what is wrong, change it…
It is light, fast and stable.

Difference between using print() for debugging and ZB debugger is like comparing anamnesis and MR.
ZB doesn’t have fancy stuff like other IDE’s like code snippets, goto definition and many more. It is quite minimal (almost zen) editor with auto-complete feature. But it can analyze your code, find errors before you even start simulator. You can watch only variables you want to watch. If you want more, you can simply hover cursor above variable in your code and ZB will pop its value. Cool thing is that if you have something like table of values: blabla.x, you can hover above blabla and get info about that table but if you move cursor above x you will get value of x. (keep in mind that you must set the breakpoints first)

There is console where you can test your code before entering it in the editor.
Another cool thing is =print function which prints table in user friendly way…

It definitely deserves an attention and, maybe, its own forum folder because author is very productive and open for suggestions. Maybe we all can help him build an excellent Corona editor… [import]uid: 101952 topic_id: 34354 reply_id: 142604[/import]

I just downloaded it and managed to change theme but how do I set the terminal to black with white text while still having the theme colors in the editor? [import]uid: 65840 topic_id: 34354 reply_id: 142613[/import]

@cindy.h1986, if by “terminal”, you mean the console and the output window, the easiest way is to add something like this to cfg/user.lua: “stylesoutshell.text = {fg = {200, 200, 200}, bg = {0, 0, 0}}”; however you will probably want to have matching colors for selection, markers and other elements, so you can simply pick a color theme that is close to what you need. For example, you can use:

local G = …
stylesoutshell = G.loadfile(‘cfg/tomorrow.lua’)(‘TomorrowNightBright’)

You can see all the pre-packaged themes and how they map to different colors in cfg/tomorrow.lua. [import]uid: 195109 topic_id: 34354 reply_id: 142653[/import]