Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support luau #1129

Open
keszegh opened this issue Dec 20, 2021 · 24 comments
Open

support luau #1129

keszegh opened this issue Dec 20, 2021 · 24 comments
Assignees

Comments

@keszegh
Copy link

keszegh commented Dec 20, 2021

Gideros is considering moving from lua to luau. I hope to be able to continue using ZBS when/if this switch happens.

See luau info:
https://luau-lang.org/

See discussion here and here:
https://forum.giderosmobile.com/discussion/comment/66096#Comment_66096
https://forum.giderosmobile.com/discussion/8498/can-anyone-teach-me-how-to-debug-with-zerobrane-studio#latest

@keszegh
Copy link
Author

keszegh commented Dec 20, 2021

perhaps this seems to be a bit early to worry about this switch, yet it would be reassuring to know if zbs can follow if needs be.

@pkulchenko pkulchenko self-assigned this Dec 21, 2021
@pkulchenko
Copy link
Owner

@keszegh, thank you for the pointer to the discussions. I looked at luau when it was announced and don't see from the list of changes why it wouldn't work with mobdebug (assuming luasocket is available as well and can be loaded), but I haven't had a chance to actually test it yet. I'll update the ticket when I get a chance to get it running.

@pkulchenko
Copy link
Owner

Actually, it's going to be difficult, as I just compiled luau and it looks to be really locked down (which makes sense for Roblox), but maybe doesn't make sense for other environments, as it doesn't allow loading dynamic libraries (or at least luasocket doesn't load for me), which makes debugging a non-starter. Also loadstring is not available either, which prevents any code evaluation (either in the remote console or as a watch eval). There is a discussion about compiling luasocket and loadstring, so there is still some hope to get it working.

@keszegh
Copy link
Author

keszegh commented Dec 21, 2021

thanks, let me know if you have more info about it. good to know that there is some hope.
feel free to join the discussion also here:
https://forum.giderosmobile.com/discussion/8518/luau-discussion#latest

@hgy29
Copy link

hgy29 commented Dec 21, 2021

@pkulchenko, Gideros version of Luau will be a bit less restricted than standard Luau: it will have loadfile, loadstring, luasocket (as a plugin). But it seems luau also removed a few debug api calls, in particular hooks, which will be difficult to replace.

@pkulchenko
Copy link
Owner

Right; hooks would need to be brought back for the debugging to work. It's good to hear that the Gideros version of luau will have those additional elements restored.

@keszegh
Copy link
Author

keszegh commented Jan 9, 2022

perhaps debugging features could be added without hooks etc?:
https://luau-lang.org/performance
"Luau does not support hooks at all, and relies on first-class support for breakpoints (using bytecode patching) and single-stepping (using a custom interpreter loop) to implement debugging."

@pkulchenko
Copy link
Owner

@keszegh, if you find details on how their client looks like and what protocol they use, I can look at that, but from what I've seen so far (assuming it's based on the breakpoint patch that was discussed on the maillist or is at least similar to it), the interaction with the debugger is going to be quite different.

@keszegh
Copy link
Author

keszegh commented Jan 20, 2022

the luau based version of gideros is public.

@keszegh
Copy link
Author

keszegh commented Jan 27, 2022

since the switch to luau, there are some things not working that i think they could:
-when opening the gideros player from zbs and then closing it, then when trying to open it again then it closes itself right after. one has to manually kill gdrdaemon task so that zbs can start the player.
-it would be nice to have live logging, now the printed messages only appear once the player is closed.
thanks
-long term of course recovering the debugging features would be very good, i miss them already

@scrumit
Copy link

scrumit commented Feb 1, 2022

+1 from me, I’m finding the enhanced syntax checking that luau provides to Gideros invaluable.

I’m sure it will be of benefit to ZBS. Do you realise Roblox has over 12 million games and 7 million game developers ? Stats

@hgy29
Copy link

hgy29 commented Feb 1, 2022

I managed to get debugging working back in Gideros Studio, but that's using native API. It comes to my mind that several interaction issues between ZBS and Gideros could be solved by implementing Gideros Player network protocol in ZBS. I can write a connector in lua (using luasocket) to expose its API, which includes:

  • Sending files to the player
  • Running/Stopping the project
  • Getting player logs
  • Starting profiler and getting profiling results
  • Setting breakpoints and launching with debugging enabled (Resume, Step over, Step Into, Step out)
  • Inspecting local variables when a breakpoint is hit

@hgy29
Copy link

hgy29 commented Feb 2, 2022

Here is a connector module, if that can help.
gideros_protocol.zip

@pkulchenko
Copy link
Owner

@hgy29, thank you for sharing! This looks very interesting and similar to the approach I took to integrate with Redis debugging where the module itself launches a proxy that the IDE debugger interacts with and the proxy actually issues commands that the Redis debugger understand (over TCP). I wonder if something similar is possible in this case.

The main debug loop starts here and shows a minimal set of commands that need to be handled. I don't see some of these commands in the gideros_protocol implementation (for example, how do I get stack information) and some details are not quite clear to me (how do I set breakpoins at a particular file/line)?

@hgy29, @keszegh, is it something you may be interested in trying to implement following the model in the redis plugin I referenced? You can implement it as a separate plugin and I'll find a way to merge it together with the current interpreter implementation (especially if there is a way to detect the version of Gideros that uses luau).

Just to add a couple more details on the redis plugin model that can work here. Basically the plugin itself is also a script that can be launched to be used as a proxy, so the plugin takes its configuration and when run/debug commands are executed, it launches the proxy script, which takes commands from the IDE and passes them on to the application it controls (Redis or Gideros), using whatever protocol is necessary in this case.

@scrumit
Copy link

scrumit commented Feb 5, 2022

Great stuff, I was going to look at the Redis plug-in for ZBS for my back end.

I notice that supports 2.0.5 and Redis on GitHub is 6.2.6.

@keszegh
Copy link
Author

keszegh commented Feb 12, 2022

i'd be happy to give some practical help, but my expertise allows me only to test if there is something to test. i hope zbs+gideros will work soon though.

@keszegh
Copy link
Author

keszegh commented Aug 10, 2022

any news? @hgy29 claims that the gideros_protocol.zip should be able to help make the connection work. sadly i'm still not knowledgeable about the details.
minimally while debugging is not working, these two should be possible to be corrected i guess earlier:
-when opening the gideros player from zbs and then closing it, then when trying to open it again then it closes itself right after. one has to manually kill gdrdaemon task so that zbs can start the player.
-it would be nice to have live logging, now the printed messages only appear once the player is closed.

btw about the first issue my workaround is that i currently run the following bat file between two runs of the gideros player:
C:\Windows\System32\taskkill.exe /f /IM gdrdeamon.exe

@keszegh
Copy link
Author

keszegh commented Jul 24, 2023

this issue is still open, it's sad that zbs cannot debug anymore gideros projects. (alas a release version of zbs from time to time would be nice even if there is no major addition). let me again emphasize the two things that should minimally work:
-when opening the gideros player from zbs and then closing it, then when trying to open it again then it closes itself right after. one has to manually kill gdrdaemon task so that zbs can start the player.
-it would be nice to have live logging, now the printed messages only appear once the player is closed.

@keszegh
Copy link
Author

keszegh commented Sep 12, 2023

a new release version is most welcome. sadly it does not address any of the most major issues concerning gideros (need to kill gdrdaemon manually, no live print logging).

@pkulchenko
Copy link
Owner

@keszegh, it does not. I don't have a ready to use solutions to integrate, but if you have some changes that you think may help with providing some of that functionality, I'll review and add them.

@keszegh
Copy link
Author

keszegh commented Sep 12, 2023

i have no expertise at all, perhaps @hgy29 can help at least with these relatively simple issues? (let alone debugging itself)

@hgy29
Copy link

hgy29 commented Sep 13, 2023

I tried to work on this, but I have to admit that I failed to understand how to set up ZBS for use with Gideros, I mean which files I need to change/update. That's mostly because I am not a ZBS user at all I guess. And while @pkulchenko gave a few pointers about how this could be done for debugging, I think it doesn't cover launching the player, getting the logs and other stuff like that.
I am ready to have a go at, but I don't know where to start.

@keszegh
Copy link
Author

keszegh commented Sep 13, 2023

i can still just mediate, in any case it would probably be easiest to discuss this on the gideros forum where you are welcome @pkulchenko. i made a new thread for this issue:
https://forum.giderosmobile.com/discussion/8701/update-zerobranestudio-to-support-luau-based-gideros-versions#latest

@hgy29
Copy link

hgy29 commented Jan 16, 2024

@pkulchenko, we made some progress on Gideros side, adding back needed debug api for mobdebug. See thread here: https://forum.gideros.rocks/discussion/comment/68692/#Comment_68692.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants