Quick Links: Gideros Home | Download Gideros | Developer Guide
Quick demo of Gideros debugging with ZeroBrane Studio
  • paulclinger +1 -1 (+5 / -0 )
    @bowerandy, @atilim, @nascode, @keszegh, I've recorded a short demo that shows various aspects of debugging a Gideros application using ZeroBrane Studio Lua IDE (http://studio.zerobrane.com/): http://notebook.kulchenko.com/zerobrane/gideros-debugging-with-zerobrane-studio-ide. The post also includes instructions on how to enable Gideros integration in the IDE. To get Gideros debugging and auto-complete, you will need to get the latest version from the Github repository (I will be packaging a new version with all these features in a few days). This is tested with Gideros 2012.08.4. Please let me know if you run into any issues.

  • evsevs +1 -1

    Fantastic stuff!!!


  • @Paul, using it on the Mac, the latest version 0.32 does not have any in-built Gideros integration (at least not as easy as the video makes it look), @Andy's instructions get it working to an extent, is there a zero configuration method for it to work on the mac osx?
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @ozapps: yes, you need to get the latest version from github repo. The packaged version (0.32) doesn't yet have that functionality. After you clone the repository, you can run ZeroBrane Studio with "./zbstudio.sh".
  • atilimatilim +1 -1
    @paulclinger thanks a lot. that's great! :)
  • bowerandybowerandy +1 -1 (+4 / -0 )
    @paulclinger, and everyone else. I can confirm that, as far as I'm concerned, ZeroBrane Studio is the missing piece in the puzzle for Gideros development.

    Actually, I quite like the Gideros IDE (I think I'm in the minority, perhaps) because it quick, simple and has a rather interesting autocomplete scheme that's a bit quirky but generally gets the job done. The one thing that's missing is the debugger.

    I've tried several other debugging solutions for Gideros but in general they require huge IDEs that need you to adopt their own way of working (no, I don't want to use Eclipse) and one thing in particular: as far as I know they don't allow you to do debugging on an ACTUAL DEVICE.

    ZeroBrane Studio does this. It's also free, it's lightweight, and there's no installation process. Oh, and I almost forgot: it's got a cool logo. There's also the rather interesting live coding feature, but more on that in another post...

    Best regards
  • Will surely give it a try^_^
  • gorkemgorkem +1 -1
    If license/Paul (community) allows (wants) us to bundle Gideros Studio, that would be a big asset and a win, in my opinion.

    Paul: what are your thoughts and long term plans with your IDE? :) whats your take on bundling?
  • @paulclinger

    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:

    local gideros
    local win = ide.osname == "Windows"
    local mac = ide.osname == "Macintosh"

    return {
    name = "Gideros",
    description = "Gideros mobile platform",
    api = {"baselib", "gideros"},
    frun = function(self,wfilename,rundebug)
    gideros = gideros or ide.config.path.gideros -- check if the path is configured
    if not gideros then
    local sep = win and ';' or ':'
    local default =
    win and ([[C:\Program Files\Gideros]]..sep..[[D:\Program Files\Gideros]]..sep..[[D:\DEV\A1New\Gideros]]..sep)

    -- I changed this above to include my path

    or mac and ('/Applications/Gideros Studio/Gideros Player.app/Contents/MacOS'..sep)
    or ''
    local path = (os.getenv('PATH') or '')..sep
    ..(os.getenv('HOME') and os.getenv('HOME') .. '/bin' or '')
    local paths = {}
    for p in path:gmatch("[^"..sep.."]+") do
    gideros = gideros or GetFullPathIfExists(p, win and 'GiderosPlayer.exe' or 'Gideros Player')
    table.insert(paths, p)
    if not gideros then
    DisplayOutput("Can't find gideros executable in any of the folders in PATH: "
    ..table.concat(paths, ", ").."\n")

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


    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:



    I shd RTFM

    I added a file in the cfg\user.lua with the line

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

    and now it works just fine.
  • @bernard: right, setting path.gideros is the easiest way if you install gideros in a non-default, non-PATH location.
  • @bowerandy, thank you for the exciting feedback.
  • @atilim, has anything related to handling global variables changed in Gideros 2012.09? @nascode is reporting in his comment to the blogpost (http://notebook.kulchenko.com/zerobrane/gideros-debugging-with-zerobrane-studio-ide#comment-100) that he gets a run-time error in mobdebug.lua on a line that references a global variable that is undefined (this is by design). I haven't had a chance to test with 2012.09 yet, but it's been working with several 2012.08.* versions I used.
  • @gorkem, thank you for the offer. This is an interesting idea; let me think about it. I don't plan to slow down much and have a long list of interesting features to add to the IDE (while still keeping it simple and lightweight). For example, one of the recent commits added syntax-aware indentation that several users were interested in.

    The two aspects I want to think about are: (1) the IDE is in an active development stage with almost daily changes, which means that some of the APIs may change (and a bundled version may require an update anyway), and (2) I'm exploring making the project a donationware to make it more sustainable long-term. I'll let you know what I come up with.
  • atilimatilim +1 -1
    @paulclinger no, I haven't changed that kind of behavior. Also I've run ZeroBrane Studio with 2012.09 before releasing that version.
  • @atilim: indeed, I just tested with the most recent 2012.09.1 and everything works as expected. Thanks for checking.

    @nascode, what platform are you on? I just tested on Windows and the debugging works with the most recent version of Gideros.
  • atilimatilim +1 -1
    @nascode are you using strict.lua? maybe this is the problem?
  • @atilim, good guess; this does look like a message from strict.lua: 'error("variable '"..n.."' is not declared", 2)'

    I'll probably add a check when strict.lua is present and register those variables to avoid this issue.
  • @atilim, is there an easy way to print values from the player to standard output? Still trying to make the debugger work with strict.lua...
  • atilimatilim +1 -1
    @paulclinger using a plugin can be a way. I've attached the plugin. You should copy log.dll to [Gideros Installation Directory]/Plugins and that's all. It defines a global function "log" which works exactly same as "print" but writes to stdout.

    If you want, you can also change global print as:
    print = log
    -- or
    local _print = print
    function print(...)

    Hope this helps

    Edit: You're on windows, right? If you want, I can build the plugin for Mac.
  • @atilim; got it working; thank you.
  • NascodeNascode +1 -1 (+1 / -0 )
    @paulclinger @atilim ah yes i am using strict.lua to help avoid messiness :)

    Likes: atilim

    have fun with our games~
  • @nascode, you can disable strict.lua for now, but I came up with a fix to the debugger that will allow you to continue using strict.lua. Will push shortly.
  • @nascode, btw, ZeroBrane Studio includes static analyzer you can use for the same purpose as strict.lua, only at compile time. It can also find potentially more issues as it covers the entire code, not just the branches you visit at run-time.
  • @paulclinger ah yes, i will try ZeroBrane's static analyzer. Thank you for your great tool :)
    have fun with our games~
  • @nascode, I pushed an updated version with a strict.lua-friendly debugger. You should be able to debug without disabling strict.lua. Let me know if you run into any issues with it.
  • I had a quick fiddle with ZeroBrane as it looks good but I couldn't get it working. I think I followed the instructions but when I try and run a project, the Gideros player opens for a while and then shuts and I get an alert box saying:
    Failed to kill process xxxx (error 5: access is denied)
    where xxxx is a different 4 digit number each time. The output in ZeroBrane reads:
    Program starting as '"C:\Program Files (x86)\Gideros\GiderosPlayer.exe"'.
    Program 'GiderosPlayer.exe' started in 'D:\gideros\Examples\Box2D_basic' (pid: 988).
    Starting the player and waiting for the bridge to connect at 'C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe'.
    Couldn't connect to the player. Try again or check starting the player and the bridge manually.

    I assume that it's not connecting properly but don't know how to sort it. How do I start the bridge manually if that is what is needed? Any help appreciated!
  • @petec, if you have a running instance of Gideros player, you may want to close it before starting the debugging from ZBS.

    You can also try starting the player from the command line to see if it's working. Try running the player and the bridge with the following commands:

    1. start "player" "C:\Program Files (x86)\Gideros\GiderosPlayer.exe"
    2. "C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe" isconnected
    This should show something like
    * daemon started successfully *

    3. "C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe" play "D:\gideros\Examples\Box2D_basic\Box2d_basic.gproj"

    This should open your project in the player (you may need to adjust your .gproj file name. If it all works, you can shutdown the player and try again in ZBS.

    If it still works when running the player directly, but doesn't work from ZBS for some reason, you can try the following:

    1. Start ZBS and start the debugger server by going to Project | Start Debugger Server
    2. Add "require('mobdebug').start()" to your main.lua script
    3. Create a batch (player.bat) file with the following to start the player (change ZBS path to match yours):

    set ZBS=D:\ZeroBraneStudio\
    set LUA_PATH=%ZBS%lualibs/?/?.lua;%ZBS%lualibs/?.lua
    start "Player" "C:\Program Files (x86)\Gideros\GiderosPlayer.exe"

    4. Run the batch file and then run gdrbridge.exe command to start your project. This should start the debugging in the IDE.
  • @bernard: right, setting path.gideros is the easiest way if you install gideros in a non-default, non-PATH location.

    Thanks Paul. Please let us know here when any update to ZeroBrane is made.
  • Thanks paulclinger for all your work, i'm glad that i could be the first advocate of zerobrane for gideros, it looks to be able to bring a big change in the way one can program in gideros. I'm also looking forward for the first official version with gideros support.
  • @paulclinger Thanks for the detailed instructions. I'm having mixed results. Starting with your first method commands 1 and 2 do what you say but command 3 doesn't run the project.

    I then tried the batch file method and by running the gridge.exe commond to start the project twice, the project started. But then, in debugging mode, I can't edit the project (I guess that's how it is?) but stopping debugging mode closed the player. If I tried starting debugging again from ZBS then I got my same old 'Failed to kill process xxxx (error 5: access is denied)' pop up so I had to go through the whole batch file etc to get it going again.

    I'm not much good when I'm having to do stuff like this and haven't got enough time at the moment to fiddle. ZeroBrane does look good so I will give it another go soon when I've got more spare time.

    Thanks for all your help, Pete
  • @keszegh, thanks for bringing this topic up on the forum; this is indeed how I noticed the interest and decided to take a closer look at integrating Gideros.

    @petec, yes, the project can't be edited while the debugging is on. If you are looking for live changes (something like @bowerandy showed in his demo), then *after* starting debugging from the player, you need to select Project | Run As scratchpad, which should enable live coding. Keep in mind that you may need to structure your code in a specific way to work better with live coding. You may look at Andy's demo and code at http://bowerhaus.eu/blog/files/live_coding.html
  • Loving this new stuff :)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • ktc +1 -1
    @atilim can we get the same log plug in for MAC? ZeroBrane works super at MAC and makes Gideros far more useful.
  • @paulclinger, I wonder how difficult it would be to work with multiple Scratchpad files in ZBS. Only the currently selected file would be "live" and updating at any one time, but I'd like the ability to be able to switch between files during a single session. I have an idea for another demo which would need this, I think.

    best regards
  • @bowerandy, it's not very difficult, but the trick is to know what editor events to track. You can search the code for scratchpad.editor to see what components refer to that functionality. There are 3 changes to the editor(s) when you turn scratchpad on:

    1. Any changes to the text are being tracked
    2. Mouse movements are being tracked to provide sliders
    3. Number style is changed to provide underlining

    The problem is not so much in enabling it; the problem is in usability. I had it enabled for all windows originally, but because you may have windows opened that have nothing to do with this particular script you're executing, any change in those windows will likely to cause errors in your application as it will be executing some arbitrary code.

    You can still make changes in other windows, and execute selected block by doing "right click" | "evaluate in console"; not as convenient as background execution, but is limited to only those changes you do want to execute.

    If you are still interested to give it a try, I can tell you what 2-3 changes to make if you want to test it; it won't be a permanent fix, but will be good enough to see if it works for you. Let me know.
  • @bowerandy, as an option, I can possibly add "Add to scratchpad" option to the "context/right click" menu to add the current editor tab to the scratchpad. This makes it more explicit and allows me to know exactly when to set those editor events and to what. It will also be useful for any new files you may open/create during that debugging session.
  • Hi @paulclinger. Well I certainly wouldn't want to enable it for all windows, just selected ones. And even then I'd only want the changes to the currently selected editor tab to be compiled and sent to the running app. Is that possible with your idea about the right click menu option?

    best regards
  • @bowerandy, right, only the changes in the currently modified window will be sent to the application. The right click menu option will simply enable tracking of changes in a particular editor tab.

    I'll give it a try as soon as I get this release out (there is only one bug and one feature left).
  • @bowerandy: FYI, I pushed couple of changes that improve error reporting during live coding. With these changes all compile errors are reported locally, which allows your application to continue working. All run-time errors are reported by the application as before.

    I also shorten the code fragment reported in the error message to make it easier to see what the error message actually is.

    I also added syntax aware indentation while I was at it...
  • @paulclinger, that's great about the shorter error message, I had been meaning to put in a request for that.

    With your first change (above), about reporting compile errors locally, does this mean that while you are typing with a compile error in your code, the changes won't stop the application from running? If this is the case then I agree that it's a very good idea. I was messing around with ZBS yesterday, and it was something I noticed was breaking app the flow while I was typing. If your latest change is as I understand it then that's a great move.

    I haven't tried the new version yet. I'll see if I get a bit of time later today.

    best regards
  • @bowerandy, yes, it should work exactly as you describe and that was the intent: only run-time errors will now stop your application (and even those can be ignored to a degree with pcalls).

    Please give it a try when you get a chance as I'm putting finishing touches before a release and want to make sure this part works not only for me.
  • @paulclinger, I've tried it and it looks good.

    I did see again one problem I came across before when making the demo video though. There is something a little screwy when using the auto complete. If one types in some text for which there are several autocomplete options, it doesn't seem possible to arrow down and choose anything other than the first offering. I assume that the down arrow key is the correct one to use?

    Just try typing "app" into a file and you'll see that you are offered "Application" and "application". I don't seem to be able to choose the latter.

    best regards
  • @bowerandy, I noticed the same thing; not sure what's causing it, but it is something I'm looking into. It seems to be a Mac-only problem, and only when using cursor keys for navigating the auto-complete list. The workaround is to use the mouse or to type enough to get your option to be first and then press Tab.
  • ktc +1 -1
    @paulclinger I enjoyed Zerobrane a lot however if you could find a way to get the print messages from Gidores to show up on your console it would be great. I am on MAC and without that it is tough to depend on Zerobrane completely.
  • @ktc, you shouldn't need to do anything to get the messages printed as everything printed to standard output is redirected to the Output panel in the IDE. In fact, there were messages printed on Mac by default that @atilim has disabled in 2012.09.1, but you can still get access to them following this recommendation: http://www.giderosmobile.com/forum/discussion/1861/why-there-is-no-debug-message-anymore-when-opening-gideros-player-from-terminal-on-mac#Item_4
  • @paulclinger

    i tried your IDE, and i like it with the debugging feature


    i'm on windows and it seems there are no output printed in the IDE output window. im using gideros 2012.9 player. and the output already says "Debugging sessions started...",

    also it seems i cant break in the middle of execution unless i hit the break execution process button multiple times.

    and also after it hit breakpoint, i encountered an error from mobdebug saying that a variable is not declared although in gideros IDE it ran just fine. i dont know if this is the cause, but im using strict.lua

    thank you
  • @bysreg,

    > i'm on windows and it seems there are no output printed in the IDE output window. im using gideros 2012.9 player. and the output already says "Debugging sessions started...",

    What output do you expect to see? If you need to add log messages, you can follow @atilim's recommendation posted earlier in this thread (http://www.giderosmobile.com/forum/discussion/comment/13147#Comment_13147). You should then see these messages in the output window.

    > also it seems i cant break in the middle of execution unless i hit the break execution process button multiple times.

    That's a feature of how the debugging works. It will only break when the execution is inside Lua code and in some cases it may be in C++ internal functions of Gideros/Lua; in this case you may need to "break" several times.

    > and also after it hit breakpoint, i encountered an error from mobdebug saying that a variable is not declared although in gideros IDE it ran just fine. i dont know if this is the cause, but im using strict.lua

    Can you post the full error message? I applied a fix on October 10th that should make the debugger strict.lua friendly. If you are using an earlier version, you may want to get the latest code from Github.

  • >What output do you expect to see? If you need to add log messages, you can follow @atilim's recommendation posted earlier in this thread (http://www.giderosmobile.com/forum/discussion/comment/13147#Comment_13147). You should then see these messages in the output window.

    i tried that one by adding this two line :

    print = log

    in main.lua

    but i got "main.lua:3: variable 'log' is not declared" (maybe this one is connected to the strict.lua)

    yesterday, i downloaded it from your git repo with zip

  • @bysreg, yes, this seems to be reported by strict.lua (and probably doesn't have anything to do with ZBS). You need to follow @atilim's advice and put log.dll he has attached to his post into Gideros/Plugins/ folder. This should fix this issue.
  • @paulclinger

    all right, now i can see the output. thank you!

    Just small suggestion, you may want to not stopping at require("mobdebug"), because i think i dont want to be bothered to clicked the play button two times to get the simulator running, and maybe ctrl+tab shortcut will be better if it acts like notepad++

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters