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 for dynamically loading MoonScript modules. #31

Open
darmie opened this issue Apr 14, 2016 · 4 comments
Open

Support for dynamically loading MoonScript modules. #31

darmie opened this issue Apr 14, 2016 · 4 comments

Comments

@darmie
Copy link

darmie commented Apr 14, 2016

Hi, have been able to use moonscript directly, using the MoonScript parser + StarLight parser. But I want to be able to require a module written in MoonScript dynamically without having to compile it to Lua.

Is there a way around this?

@paulcuth
Copy link
Owner

This is an interesting challenge; if I understand correctly, the MoonScript parser is written in Lua and therefore could be translated to run in the browser using Starlight. Once in the browser, there's no reason why it couldn't be used to process MoonScript tags before parsing with Starlight.

The job would be made easier if Starlight provided some lifecycle hooks along the way. I'll have play with this and let you know.

@darmie
Copy link
Author

darmie commented Apr 18, 2016

Cool, looking forward to it.

@pablomayobre
Copy link

This is not that easy, Moonscript uses LPeg which is a binary library, this is the reason Moonscript has a .dll file in Windows and most likely a .so file in Linux.

There exists an alternative to LPeg written entirely in Lua called Lulpeg, I don't know how efficient that would be or if it does use functions not available in Starlight or missing some feature Moonscript needs, but checking if it works may be worth the effort.

@darmie
Copy link
Author

darmie commented Aug 8, 2017

@positive07 I was able to achieve compiling Moonscript in a browser. There is a Moonscript compiler JavaScript port, which is currently in use on moonscript.org

The issue here however, is how to dynamically require a .moon module within Starlight framework.

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

No branches or pull requests

3 participants