MoonScript is a dynamic scripting language that compiles into Lua. It gives you the power of one of the fastest scripting languages combined with a rich set of features.
MoonScript can either be compiled into Lua and run at a later time, or it can
be dynamically compiled and run using the moonloader. It’s as simple as
Because it compiles right into Lua code, it is completely compatible with alternative Lua implementations like LuaJIT, and it is also compatible with all existing Lua code and libraries. The command line tools also let you run MoonScript directly from the command line, like any first-class scripting language. A comprehensive overview of the language can be found in the reference manual, the rest of this page serves as an overview of the language. OverviewMoonScript provides a clean syntax using significant whitespace that avoids all the keyword noise typically seen in a Lua script. Below is a sample of some constructs found in the language.
It also adds table comprehensions, implicit return on functions, classes, inheritance, scope management statements import & export, and a convenient object creation statement called with.
It can be loaded directly from a Lua script without an intermediate compile step. It even knows how to tell you where errors occurred in the original file when they happen. InstallationInstalling with LuaRocksIf you're on Windows, then install the Windows binaries, otherwise the easiest way to install is to use LuaRocks. LuaRocks can be obtained here or from your package manager. After it is installed, run the following in a terminal:
This will provide the Windows BinariesProcompiled Windows binaries are available to avoid the trouble of compiling: Extract the contents into your OptionalIf you're on Linux and use watch mode (which compiles SourceThe source code to the project lives on github: Issues with the tool can be reported on the issue tracker: The latest development version can be installed with the dev rockspec:
DependenciesIn addition to Lua 5.1 or 5.2, the following Lua modules are required to run the compiler and associated tools:
All of the required ones can be retrieved automatically using the LuaRocks installation. Extras & AddonsEditor SupportVim syntax and indent: Textmate (and Sublime Text) syntax and indent: SciTE (with scintillua) syntax: Preconfigured and packaged version of SciTE for Windows with MoonScript
support: ToolsOnline Compiler: Overview of Differences & HighlightsA more detailed overview of the syntax can be found in the documentation.
AboutThe syntax of MoonScript has been heavily inspired by the syntax of CoffeeScript. MoonScript is CoffeeScript for Lua. MoonScript would not have been possible without the excellent tool LPeg for parsing. |
|