Gideros debugging with ZeroBrane Studio

Gideros is a flexible framework for developing mobile applications for iOS and Android platforms. It is using Lua as its scripting language and after several people on Gideros forums expressed their interest in using ZeroBrane Studio IDE, I thought I would take a look at supporting Gideros in the IDE.

ZeroBrane Studio supports two ways to debug applications. One way is to launch the application from the IDE, which allows for tighter integration as the IDE can set the environment for the process and can kill the process when the user aborts debugging or running the application. Another way is to start the application externally and make it connect to the debugger in the IDE, thus allowing the IDE to control the application. This second way was my first recommendation and it took couple of hours to implement support for debugging in the IDE.

The video below demonstrates debugging support for Gideros scripts in ZeroBrane Studio (you may need to switch the video to 720p to make the text more readable):

To enable the integration shown in the demo, you need to do these three steps:

  • Add require("mobdebug").start() line to your main.lua script.
  • Select Gideros as an interpreter in ZeroBrane Studio going to Program | Lua Interpreters | Gideros. In addition to enabling debugging, it will also turn on auto-complete for Gideros API calls. If the Gideros player executable is in a default location (/Applications on OSX or C:\Program Files or D:\Program Files on Windows) or in one of the folders listed in PATH, it will be found by the IDE. If the executable is in a different location, you may need to specify this location in cfg/user.lua file (see cfg/user-sample.lua for details on how this is done).
  • Set the project folder to point to your project location by using the Project pane on the left side of the IDE window; for example, point it at one of the examples at D:\Program Files\Gideros\Examples\Physics\Sleeping Bodies.

You can now open main.lua file from your project in the IDE and use Project | Start Debugging command to debug your application.

Another interesting aspect of Gideros and ZeroBrane Studio integration is that it also allows debugging and live coding of applications running on an actual device.

You should get a copy of my slick ZeroBrane Studio IDE and follow me on twitter here.

9 Comments

I posted this in the Gideros forum

I d/l the github version and selected Gideros as the Lua Intepreter.

I loaded the "Sleeping Bodies" sample and tried to run it.

I get this error in the window below:

Can't find gideros executable in any of the folders in PATH: C:\Program Files\NVIDIA Corporation\PhysX\Common, C:\Program Files\Common Files\Microsoft Shared\Windows Live, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\system32\WBEM, C:\WINDOWS\system32\WindowsPowerShell\v1.0, C:\Program Files\Microsoft SQL Server\100\Tools\Binn\, C:\Program Files\Microsoft SQL Server\100\DTS\Binn\, C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\, C:\Program Files\Common Files\Roxio Shared\DLLShared\, C:\Program Files\Gideros, D:\Program Files\Gideros

I have installed Gideros in "D:\DEV\A1New\Gideros" so obviously the IDE is not finding it.

After doing a search I found a file called gideros.lua in the ZeroBrane\interpreters\ folder:

[edited: code skipped]

Now the project runs in the player from ZeroBrane after I added the line

require('mobdebug').start()

Obviously there is an issue with finding the path in ZeroBrane and this can easily be fixed so the user can set any path to Gideros manually instead of looking at the PATH variable. Better still use the path value stored in the Registry at:

[HKEYCURRENTUSER\Software\Gideros]

Excellent work once the path problem is sorted.

Hello, Congrats for Gideros integration

I was tried your steps in debugging gideros lua codes but i got error from gideros player:

mobdebug.lua:26: variable 'mosync' is not declared stack traceback:

I am using Gideros 2012.09

@Bernard, You can add the following line to cfg\user.lua:

path.gideros = 'D:/DEV/A1New/Gideros/GiderosPlayer.exe'

@nascode, I'll need to take a look at that; line 26 refers to a global variable that may be not set, but it should not cause an error. I tested with Gideros 2012.08.4 and will re-test with 2012.09.

@nascode, I just tested with Gideros 2012.09.1 and everything works as expected. What platform are you on? We can continue here or in Gideros discussions: http://giderosmobile.com/forum/discussion/comment/13138#Comment_13138

ZeroBrane Studio is really a cool ide.

It's great to see it support Gideros. Any plan to support Wax?

Bhou, thank you; support for Gideros includes debugging and auto-complete functionality. When you think about Wax support, do you have BhWax in mind or Corey's Wax?

Thanks for you reply! Actually I am talking about both of them. AFAIK, BhWax is based on Corey's Wax, I guess there aren't too much difference between them (Maybe I am wrong).

Compared with bhwax, I think Corey's Wax needs an IDE more than bhwax. I tried Corey's Wax recently, the xcode project template does not work any more for xcode 4. The textmate bundle seems stopped updating for a long time, lots of functions do not work. All these make Corey's Wax difficult for dev. If zerobrane studio can support it, that would be great!

For BhWax, Andy Bower has added the text-completion in Gideros (Currently I use it for dev, and it's not bad). I tried to debug the bhWax based app in Zerobrane, but I didn't figure out how to make it work. So I suppose zerobrane does not support bhWax yet, am I right?

Thanks

bhou, you are correct, there is no auto-complete support for bhWax at this time in ZeroBrane Studio. Although you should be able to debug Gideros applications that use bhWax in the same way you debug any other Gideros application in ZBS.

You can also enable auto-complete for dynamic words (using acandtip.nodynwords = false in cfg/user.lua), which will gather all the words from the current and all other open windows in the IDE. Not quite the same as full auto-complete, but still better than nothing and the choice is limited to the API you actually use, which generates fewer superfluous matches.

Leave a comment

what will you say?
(required)
(required)

About

I am Paul Kulchenko.
I live in Kirkland, WA with my wife and three kids.
I do consulting as a software developer.
I study robotics and artificial intelligence.
I write books and open-source software.
I teach introductory computer science.
I develop a slick Lua IDE and debugger.

Recommended

Close