which lua IDE/Debugger is the best for cocos-2dx

I’ve tried some IDE/debuggers, but most of them have some problems.

1 decoder
Can’t debug over devices
Only support for windows

2 Zerobrane
Debugger is very slow, perhaps it’s the fault for mobdebug.lua
I’ve changed some src code of zerobrane to support remote debugging of cocos-2dx and also tips for code. But the tips is very week and IDE don’t support reference jumping.

BTW, Is there any tools to compile type language (Such as java/c#/c++) to lua?

Thx a lot

Have same question, what IDE i can use for windows and HOW?

@cong ling, debugging could be slow in ZeroBrane Studio as it relies on Lua debug hook and does its own processing in it. I’m working on several performance improvements, but can’t say how much faster it’s going to be until they are completed; the results are also highly application dependent.

One of the options to improve performance is to use on()/off() calls to turn debugging on and off. When you turn it off, your application will run with the “original” speed. You can wrap a section of your code into on() and off() calls and then breakpoints and all other debugging functions will work in that section. You can find an example in the section on Selective Debugging here (http://notebook.kulchenko.com/zerobrane/marmalade-quick-debugging-with-zerobrane-studio). I also have demos and descriptions of debugging functions posted here (http://studio.zerobrane.com/documentation.html#Debugging).

I’ve changed some src code of zerobrane to support remote debugging of cocos-2dx and also tips for code.

Have you made your changes available somewhere? Maybe I can integrated them into the main package.

But the tips is very week and IDE don’t support reference jumping.

Can you elaborate on being “week”? Right now auto-complete is using syntax analysis (which is definitely limited), but there are some improvements coming, which will allow to specify methods and returned value types. Reference jumping is being worked on, but probably won’t make it into the next version. Paul.

Hi Paul,
Nice to meet you here. Zerobrane is very good designed and helpful. I’ve used it since I tried Gideros.
I integrated LuaJit to replace lua5.1 in cocos2dx, because ZeroBrane is open sourced, able to remote debugging and also can debug luajit, we switch to this debugger. But I’ve found that the performance of debugger is slower than decoder comparing under lua5.1. We can keep 20-30 fps under decoder, but only 6-7 fps under Zerobrane.
We’re still in a project right now, the code is mess and also is very project-related. It may cost you a lot of time to extract code from our src right now. After we finish the project, we can extract the code and submit to github. Here’re our changesets for cocos2dx and Zerobrane

  1. Stub and debugger (following the pattern of Gideros)
    Write the stub (IOS/Android/Windows/OSX) for debugging under Zerobrane
    stub is to receive the package sent by Zerobrane and setup the debugging connection automatically
    Write extensions in Zerobrane to support transfer code/assets from Zerobrane to Stub.
    Let the debugging process more easier (setup the debugging port automatically in Zerobrane. When stub received the package, auto setup debugging process to the debugger).
  2. We integrated luajit to replace lua5.1
  3. We integrated luajava and also changed some code in luajava (use the lua_state from luajava, fix the bug when GC thread to finalize the luajava object)
  4. support run mode for Zerobrane
    Now we’ve written some shell to increase the code completion for our project. But it’s also project-related. The code completion system is not context-sensitive, such like the following code:
    obj = MyClass:create()
    obj.MyMethod() —cannot show code completion of this object for developers.
    I think it’s very important for developers but perhaps it’s very hard to do that.

Thanks for your reply.

Hi Paul K!

I have been playing around with you Lua IDE and find it very good, if it could support debugging for cocos2d-x it would be great! I have made a script for the code completion for cocos2d-x based version 2.1rc0-x-2.1.3 (the new upcoming one at the time). The script is generated by the parser I’ve made, from the .pkg files so updating it shouldn’t be a problem. It is 95% accurate, but there are some things that are in but aren’t used like CCImage, CCNodeRGBA, … if you find it useful use it in your IDE. I’ll fix the script in the future.

Best,

Stanko

Stanko Krstić wrote:

I have been playing around with you Lua IDE and find it very good, if it could support debugging for cocos2d-x it would be great! I have made a script for the code completion for cocos2d-x based version 2.1rc0-x-2.1.3 (the new upcoming one at the time). The script is generated by the parser I’ve made, from the .pkg files so updating it shouldn’t be a problem. It is 95% accurate, but there are some things that are in but aren’t used like CCImage, CCNodeRGBA, … if you find it useful use it in your IDE. I’ll fix the script in the future.

@Stanko, this looks very good. Thank you for contributing the API description. Unfortunately, I’d need an interpreter to associate it with (as API files get references from interpreter files). Having an interpreter would also allow to support debugging of cocos2d-x applications.

What is the state of luasocket support in the current version? If there is a way to run luasocket, I should be able to take a shot at integrating cocos2d-x debugging into ZBS (and including your API description).

Paul.

cong ling wrote:

Nice to meet you here. Zerobrane is very good designed and helpful. I’ve used it since I tried Gideros.
We can keep 20-30 fps under decoder, but only 6-7 fps under Zerobrane.

@cong ling:

The current version of ZBS (0.361) includes significant performance improvements in the debugger. I’d be curious to see if you get any better performance running it comparing to the old version. I’ve run simple benchmarks on Lua scripts and love2d games I have and in some cases got as much as 5-10x improvement in terms of fps or reduced running time under the debugger. Obviously this depends on the application you are running (the less time is spent in Lua code, the smaller the improvement effect is likely to be).

  1. support run mode for Zerobrane
    Now we’ve written some shell to increase the code completion for our project. But it’s also project-related. The code completion system is not context-sensitive, such like the following code:
    obj = MyClass:create()
    obj.MyMethod() —cannot show code completion of this object for developers.
    I think it’s very important for developers but perhaps it’s very hard to do that.

I agree; this functionality is supported when you provide an API description (similar to what Stanko did). For example, you can provide a description for MyClass class and indicate that its “create” method returns an instance of a particular (other) class (using “valuetype” property).

However, it needs to be pre-configured; for example, it would be great if ZBS could scan your project files and simply figure out what methods your classes have and to provide auto-complete for those. I do have plans to support something like this, but given a variety of ways in which classes/objects can be defined in Lua, it’s a quite challenging problem…

Paul.

zerobrane is not free

@jp wei, it’s available for free and under the MIT license; all the sources are on Github. We ask for a payment to support the project and it’s your choice whether to support or to download for free. Paul.

OK Has been downloaded!

Paul K wrote:

@jp wei, it’s available for free and under the MIT license; all the sources are on Github. We ask for a payment to support the project and it’s your choice whether to support or to download for free. Paul.

Hi,
i integrated LuaSocket from https://github.com/yangzhu6263736/cocos2dx-lua-ext to my cocos2dx version. But im not sure what to do next.

I copied the mobdebug.lua to my script directory, started Zerobrane and set the directory to my lua script directory. I inserted require(‘mobdebug’).start() to my lua script in a function i call from my c++ cocos2dx code. After that i started the debug server and started debugging. Next i started my application.
All i get is an errror that the connction was closed for unkown reason.

So do anybody knows whats wrong? Is there a step by step example using cocos2dx? How can i check if my luasocket integration works?

code developer wrote:

I copied the mobdebug.lua to my script directory, started Zerobrane and set the directory to my lua script directory. I inserted require(‘mobdebug’).start() to my lua script in a function i call from my c++ cocos2dx code. After that i started the debug server and started debugging. Next i started my application.
All i get is an errror that the connction was closed for unkown reason.
>
So do anybody knows whats wrong? Is there a step by step example using cocos2dx? How can i check if my luasocket integration works?

I don’t see anything wrong with your description. Does the debugging start for you in the IDE and then stops?

This is what I just posted in another thread (http://www.cocos2d-x.org/boards/11/topics/15813):

I posted instructions on how to get the debugging working with luasocket being used as a dynamic library or integrated with cocs2d-x here: http://notebook.kulchenko.com/zerobrane/cocos2d-x-simulator-and-on-device-debugging-with-zerobrane-studio ; descriptions for some of the options are based on the feedback provided by others, so I’d appreciate comments on what’s working and what’s not for you.

Hi paul, i get the same result with code developer, i set the enviroment with your:http://notebook.kulchenko.com/zerobrane/cocos2d-x-simulator-and-on-device-debugging-with-zerobrane-studio
my app crashed without any log.

Paul K wrote:

code developer wrote:
> I copied the mobdebug.lua to my script directory, started Zerobrane and set the directory to my lua script directory. I inserted require(‘mobdebug’).start() to my lua script in a function i call from my c++ cocos2dx code. After that i started the debug server and started debugging. Next i started my application.
> All i get is an errror that the connction was closed for unkown reason.
>
> So do anybody knows whats wrong? Is there a step by step example using cocos2dx? How can i check if my luasocket integration works?
>
I don’t see anything wrong with your description. Does the debugging start for you in the IDE and then stops?
>
This is what I just posted in another thread (http://www.cocos2d-x.org/boards/11/topics/15813):
>
I posted instructions on how to get the debugging working with luasocket being used as a dynamic library or integrated with cocs2d-x here: http://notebook.kulchenko.com/zerobrane/cocos2d-x-simulator-and-on-device-debugging-with-zerobrane-studio ; descriptions for some of the options are based on the feedback provided by others, so I’d appreciate comments on what’s working and what’s not for you.

ryan zheng wrote:

Hi paul, i get the same result with code developer, i set the enviroment with your:http://notebook.kulchenko.com/zerobrane/cocos2d-x-simulator-and-on-device-debugging-with-zerobrane-studio
my app crashed without any log.

Hi Ryan Zheng,

Since you mentioned in another thread that you run iOS app, I assume you included luasocket into your cocos2d-x setup. Can you try to add “require ‘socket’” and “require ‘mobdebug’” to your code (instead of calling “require(‘mobdebug’).start()” to see whether it fails on module load or on “start()” call? Also, do you run in the simulator or on the device? Do you link against Lua or LuaJIT engine?

Hi paul, very glad to receive your reply. I fix the problem by set my zerobrane project path to my ios app which contains the target lua script.
thanks for your reply, zerobrane is a very cool IDE!
Paul K wrote:

ryan zheng wrote:
> Hi paul, i get the same result with code developer, i set the enviroment with your:http://notebook.kulchenko.com/zerobrane/cocos2d-x-simulator-and-on-device-debugging-with-zerobrane-studio
> my app crashed without any log.
>
Hi Ryan Zheng,
>
Since you mentioned in another thread that you run iOS app, I assume you included luasocket into your cocos2d-x setup. Can you try to add “require ‘socket’” and “require ‘mobdebug’” to your code (instead of calling “require(‘mobdebug’).start()” to see whether it fails on module load or on “start()” call? Also, do you run in the simulator or on the device? Do you link against Lua or LuaJIT engine?

ryan zheng wrote:

Hi paul, very glad to receive your reply. I fix the problem by set my zerobrane project path to my ios app which contains the target lua script.
thanks for your reply, zerobrane is a very cool IDE!

Hi Ryan, very glad you resolved the issue. Are you using ZeroBrane Studio v0.38 or are you using the latest code form github? When you say “set project path to my ios app” do you mean you set it to the folder where the packaged application is (something like ‘/users/…./library/application support/iphone simulator/6.1/applications/13e34ef7-594a-4d62-a2c7-9451d726275c/luatest2.app/’) or the folder where your project is (something like ‘/Users/…./Documents/Projects/LuaTest2/LuaTest2/Resources/’)?

Hi Paul, The version of ZeroBrane which i’m using is 0.38 and i have not try the latest code from github.
I exactly set the project path to the folder where the packaged application is. I see the “Note on debugging in the iOS simulator.” in your article, i’ll try it later.
Thanks again!
In order to communicate with you, may i ask your frequently used email ?

Paul K wrote:

ryan zheng wrote:
> Hi paul, very glad to receive your reply. I fix the problem by set my zerobrane project path to my ios app which contains the target lua script.
> thanks for your reply, zerobrane is a very cool IDE!
>
Hi Ryan, very glad you resolved the issue. Are you using ZeroBrane Studio v0.38 or are you using the latest code form github? When you say “set project path to my ios app” do you mean you set it to the folder where the packaged application is (something like ‘/users/…./library/application support/iphone simulator/6.1/applications/13e34ef7-594a-4d62-a2c7-9451d726275c/luatest2.app/’) or the folder where your project is (something like ‘/Users/…./Documents/Projects/LuaTest2/LuaTest2/Resources/’)?

Hi Ryan,

ryan zheng wrote:

Hi Paul, The version of ZeroBrane which i’m using is 0.38 and i have not try the latest code from github.
I exactly set the project path to the folder where the packaged application is. I see the “Note on debugging in the iOS simulator.” in your article, i’ll try it later.

Make sense; if you get the latest code from github, you can then set the project folder to the folder with your application scripts (not the packaged app), which should simplify the setup. I still don’t know why exactly it was crashing and can’t reproduce it.

In order to communicate with you, may i ask your frequently used email ?

Sure; forums work too, but if you send me something over email, my address is at the bottom of the blog post I referenced earlier or in my github profile: https://github.com/pkulchenko. Paul.