Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
zerobrane lua IDE with gideros support.. what do you think about this ide(a)? - Page 3 — Gideros Forum

zerobrane lua IDE with gideros support.. what do you think about this ide(a)?

13

Comments

  • > First step would be to determine what have changed.
    > Does new zerobrane work ok with old Gideros, or new Gideros with old zerobrane?

    I can't test either one at the moment, but, as I said, I suspect that it may be related to the changed handling of debug.traceback in Gideros. Didn't you move away from Lua 5.1?

    @ar2rsawseen, how do you capture and send the error back to Gideros Studio? If this somehow works for you, I may be able to find a way to make it work for ZBS as well. For others toolkit ZBS uses their stderr/stdout to show in the IDE, but in your case this doesn't seem to be an option as this is not reported by gdrbridge.
  • I myself get a little peeved when I get some random error with no clue as to what has actually gone wrong. However, ZeroBrane is miles better than the default Gideros Studio, that outline pane!!!!!. The only time I use the Gideros Studio is to add stuff to my projects these days.
  • Thank you for the feedback, @antix. The next version will add a panel for bookmarks/breakpoints (to see/manage them in one place) and will also save them between restarts.

    > The only time I use the Gideros Studio is to add stuff to my projects these days.

    I've been thinking about adding a local menu in the filetree to add a file to the gideros project file, but haven't gotten time yet. This would also require extracting gideros-related files in a separate plugin in ZBS (and distributing it from the plugin repository), but this shouldn't be an issue as it only needs to be installed once.

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • very nice plans, hopefully the error reporting can be sorted out too.
  • @paulclinger you're welcome. I look forward to seeing the bookmarks manager, and having them be persistent will be awesome.

    @keszegh - make less errors then =))
  • I also use ZBS for most of our dev work, but I always switch to Gideros IDE when I have runtime errors. The Gideros IDE has improved recently, but ZBS has some great features.
  • @ar2rsawseen, I looked through the Gideros Studio code, but don't see anything related to error handling from the player. Do you have any pointers on where this logic may be?

    Can someone post a screenshot from Gideros Studio that shows a run-time error in the application? Thanks.
  • @antix
    - i wish i could make less errors, but somehow i constantly make typos etc.
    @paulclinger
    - i think gideros did not move away from luajit, luajit is only optional. @ar2rsawseen, am i right?
    i posted a screenshot of a runtime error, although i think it's not so informative. you could install gideros studio for yourself to test, it takes a minute, it's no hassle to set up (and uninstall later).

    Screenshot 2015-12-31 09.52.54.png
    1605 x 1046 - 95K
  • Basically Gideros Studio handles it's own socket connections here:
    https://github.com/gideros/gideros/blob/master/ui/giderosnetworkclient2.cpp

    Specifically we send error simply as string and Gideros studio handles it here:
    https://github.com/gideros/gideros/blob/master/ui/giderosnetworkclient2.cpp#L112

    and emits dataReceived, which goes straight to output pane:
    https://github.com/gideros/gideros/blob/master/ui/mainwindow.cpp#L803-L813

    But as I said, we have a plans of separating it into gdrbridge and make Gideros Studio use it, but in that case the logic will be probably be changed, cause it probably would not be able to work as it is now.
  • @keszegh yes, LuaJit is an optional plugin/patch.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • I know it's getting off topic but why doesn't Gideros just use LuaJit by default? It is supposed to make everything run faster, and I hear it has a proper PRNG in there somewhere too.
  • It will be a problem on iOS and maybe soon OSX as Apple require code in bitcode - so they can recompile it. LuaJIT uses some assembly code in the way it works - so this excludes it.

    With WindowsPhone you need to have code compiled in Arm 'Thumb' mode - again this is a problem as the current version of LuaJIT does not support Arm 'Thumb'. It could be though - I was going to patch it before the problem with Apple raised its ugly head. Also it now looks like WindowsPhone10 can use proper Arm code rather than just Arm Thumb code.

    HTML converts to bitcode too, so this would be a problem like OSX.

    What could possibly happen is Gideros could use:

    1) Android Arm & x86, Windows Desktop, Windows x86, Raspberry Pi: LuaJIT bytecode

    2) WindowsPhone, HTML: Lua bytecode

    3) OSX, iOS, Packfile: Lua source code (!!!)

    The reason for (3) is because Lua Bytecode needs to be encoded differently (I think it's the byte ordering) on 32-bit and 64-bit processors. Maybe in the future we could have 'something' that plugins in before Lua sees the bytecode and converts it from one encoding to the other 32<->64 bit byte ordering. Is so then the above would be:

    2) WindowsPhone, HTML, OSX, iOS, Packfile: Lua bytecode.

    Maybe the packfile could actually contain both Lua bytecode and LuaJIT bytecode - so the file would run faster on (1) by loading LuaJIT if that is what that system uses.

    You can tell which you are running on because the table 'jit' is defined in Lua.

    I'm not too sure either if you should include a 'bit' library with LuaJIT as it's built-in, by including it you may be slowing it down as Lua may then use the slower version of 'bit' - but I'm not sure.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Ahh, confusing to my wee brain :)
  • Just done a test and the bit library isn't needed with LuaJIT - it's built-in, but it looks like it will use the built-in version in preference to any external version.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • this luajit question is a bit offtopic.
    so going back to the main track:
    i hope the error report in zbs will be sorted out too.
    +1 -1 (+2 / -0 )Share on Facebook
  • keszeghkeszegh Member
    edited January 2016
    any news about this?
    @paulclinger, could you make sense of the gideros source code, how gideros studio does error message handling? did you check @ar2rsawseen's latest comments in this topic?

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • (just noticed that my response last week didn't get posted)

    > @paulclinger, could you make sense of the gideros source code, how gideros studio does error message handling? did you check @ar2rsawseen's latest comments in this topic?

    @keszegh, I checked the gideros studio source code, but it seems like they "cheat" a bit ;) and don't use gdrbridge in this case, but instead use direct socket connection to the player (which is what @ar2rsawseen indicated earlier). This allows the studio to get the error from the player (as it's sent before the connection is closed) as well as to control multiple players; none of these options are available through gdrbridge.

    I don't mind looking at generating this functionality, but this essentially means re-implementing what gdrbridge does (the communication protocol used between gdrbridge and the player). I may be wrong with my reading of the code, but this is my current impression of how things work.
  • hgy29hgy29 Maintainer
    Hi @paulclinger, AFAIK you can get player output log through gdrbridge already.
    There is a 'gdrbridge getlog' command which returns the not-yet-read log buffer content. You'll have to poll it though. How do other SDK behave ?
  • hgy29hgy29 Maintainer
    And for the discovery procedure, I am thinking of adding a 'gdrbridge discover' command that would return a table of visible devices, such as:
    NAME1 HOST1:PORT1
    NAME2 HOST2:PORT2
    xxx
    Would this do ?
  • hgy29hgy29 Maintainer
    So I finally did it that way:
    $ Release/Tools/gdrbridge.exe discover
    Qt: Untested Windows version 10.0 detected!
    192.168.1.192|62730|0|1453209948|NICO-WIN10
    192.168.1.192|62739|0|1453209948|NICO-WIN10
    192.168.1.192|15000|0|1453209948|NICO-WIN10
    Fields are: IP|Port|Flags (currently 0)|Last advertisement time|Name

    @totebo: Notice multiple players listening on different ports on the same machine :)
    +1 -1 (+3 / -0 )Share on Facebook
  • @hgy29, it would be great to run/test multiple players from zbs, so thanks for adding this to gdrbridge.

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    @keszegh, if you mean sending to all players in one click then I am planning to do so too, however it doesn't work smoothly in gideros studio, so I'd better start by fixing it here.
  • keszeghkeszegh Member
    edited February 2017
    that sounds cool, although starting one by one is fine with me.
    but the zbs error handling issue is much more important so far.
  • > There is a 'gdrbridge getlog' command which returns the not-yet-read log buffer content. You'll have to poll it though.

    This may work; I assume after this command the buffer content is reported to the standard output?

    > How do other SDK behave ?

    Most others either allow launching their simulators directly (like Corona, which dumps errors to its output) or report errors in their own windows (like Love2d).

    > it would be great to run/test multiple players from zbs, so thanks for adding this to gdrbridge.

    @keszegh, as far as I understand, this only works for discovery and running in multiple players would (1) still require contacting them one-by-one using Gideros protocol, or (2) needs to be added to gdrbridge as @hgy29 indicated.

    @hgy29, if you are going to implement this, I'd prefer "setip" to either take multiple parameters, or to at least allow multiple "setip" calls to add multiple players to play the project on.
  • any news about this?
    @paulclinger, could you make sense of the gideros source code, how gideros studio does error message handling? did you check @ar2rsawseen's latest comments in this topic?
    Any happenings here? I'm finding more and more I need to keep switching between ZB and Gideros to see where my code is not working, its laborious to say the least :(

    On a side not, I began using notepad+ for editing javascript and it is so like ZB (or the other way round?). Its great to have common shortcut keys and stuff between applications :)
  • > Any happenings here? I'm finding more and more I need to keep switching between ZB and Gideros to see where my code is not working, its laborious to say the least

    @antix, I agree, it's a bummer, but I looked at the Gideros code and it seems like full support for it will require full implementation of Gideros protocol to support getting the error information back. I still have to check the information returned by "getlog" gdrbridge, which may provide a short-term solution.

    > On a side not, I began using notepad+ for editing javascript and it is so like ZB (or the other way round?). Its great to have common shortcut keys and stuff between applications

    I think it may look this way because both ZBS and notepad+ are using the same editor component (Scintilla). You should be able to use ZBS for that as well, but it requires a bit of configuration. I plan to implement a "universal" specification plugin that will allow syntax highlighting and folding for all file types supported by Scintilla.
  • @paulclinger - thanks Paul. I hope the "getlog" approach bears some fruits :x

    Ahh I see now why they are so similar, thanks for the explanation :)
  • paulclingerpaulclinger Member
    edited January 2016
    @antix, @keszegh, here is the diff I'd like you to try. Just apply it to the current interpreters/gideros.lua file (should be simply to apply manually too):
    diff --git a/interpreters/gideros.lua b/interpreters/gideros.lua
    index 3313020..d5f8b58 100644
    --- a/interpreters/gideros.lua
    +++ b/interpreters/gideros.lua
    @ return {
         else
           local cmd = ('"%s"'):format(gideros)
           -- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
    -      pid = CommandLineRun(cmd,self:fworkdir(wfilename),not mac,true)
    +      pid = CommandLineRun(cmd,self:fworkdir(wfilename),not mac,true,nil,nil,function()
    +          local cmd = ('"%s" %s'):format(gdrbridge, 'getlog')
    +          ide:ExecuteCommand(cmd,self:fworkdir(wfilename),function(s)
    +              -- remove all "status" messages from the output
    +              s = s:gsub("%f[\r\n]%s*%*.-[\r\n]",""):gsub("^%s*%*.-[\r\n]+","")
    +              DisplayOutput(s)
    +            end)
    +        end)
           if not pid then return end
         end
    It uses "getlog" command to show the error message after the running or debugging session is over (you may need to use "Stop" menu/button if the player doesn't end the process after an error). This only works with the player running locally (which should cover the majority of the cases); it should be possible to make it work for remote sessions as well, but requires some changes to ZBS API, so I'll work on it a bit later.

    Let me know if this patch works for you and I'll get it in. Thanks. Paul.

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • @paulclinger - well that works for me so far. Once I end the program, the error message is output in ZBs' console. Just another thing that will save many hours in development time, awesome!
  • @antix: sounds good; thank you for the update!
Sign In or Register to comment.