leafo / moonscript

:crescent_moon: A language that compiles to Lua

Home Page:https://moonscript.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrate MoonScript with LuaJIT?

VinnyVicious opened this issue · comments

I have a very small project that uses LuaJIT along with my C++ application for scripting. I would love to integrate MoonScript directly with it, so I don't need any pre-compilation step and LuaJIT just parses MoonScript files as if they were Lua files. Is there anyway of doing this, or is the CLI tool and compilation step absolutely necessary?

Howl does this, it can compile MoonScript either ahead of time (for built-in files) or at runtime (for user added bundles). I think most of the relevant code is in init.lua.

spook does this as well.
See https://github.com/johnae/spook/blob/b407ea5b96d50d0ff1f2878c40be39e64ab68ff8/init.moon#L64
and
https://github.com/johnae/spook/blob/b407ea5b96d50d0ff1f2878c40be39e64ab68ff8/init.moon#L154.

Spook, when compiled, becomes a single executable capable of running either lua or moonscript directly which sounds like what you're after.

Precisely what I was looking for. Thanks for the links, guys. I was looking for a solution in C++, but I get what you're doing in Lua and it's pretty clever.

commented

Closing this then. Not that this issue is a problem, but if you'd like to chat with other moonscript users we have a discord: https://discord.gg/Y75ZXrD