Browse docs
Moonscript Support
Moonscript support ships built-in to lde. Any .moon files in your src dir will automatically be compiled ahead of time to lua into your target directory.
Quickstart
- Run this and cd into it:
lde new --language moonscript ./hello-moon
The scaffold writes src/init.moon as the entry point; no other configuration is needed as .moon files compile to Lua automatically.
- Replace
src/init.moonwith:
greet = require("hello-moon.greet")
n = 40
print(greet("moon") .. " " .. tostring(n + 2))
- Make
src/greet.moon:
greet = (name) -> "hello " .. name
return greet
- Run it with
lde run
The output is:
hello, moon 42
The file src/init.moon is the entry point. This is the same as src/init.lua for packages that use Lua.