Aviva Directory » Computers & Internet » Programming » MoonScript

MoonScript is a dynamic scripting language that compiles into Lua, combining the power of one of the fastest scripting languages with a rich set of features found in Lua.

MoonScript was created by someone who goes by the pseudonym of Leafo, although his real name might be Kyle Klegg or Jason Moon, who is associated with MoonScript on at least one GitHub repository.

The primary goal of MoonScript is to make writing code faster and more enjoyable, achieving this through an intuitive syntax and simplified features, allowing developers to focus on solving problems without strict rule sets. It was first released in September of 2015 and is available under the MIT License.

MoonScript was influenced by CoffeeScript, with which it shares similarities, although some of its features, such as table comprehensions and implicit returns, were inspired by Python.

MoonScript can be compiled into Lua and run later, or dynamically compiled and executed using its moonloader, a function that searches for a valid MoonScript file. MoonScript is compatible with LuaJIT and existing Lua code and libraries. MoonScript can also be run from the command line like any first-class scripting language.

MoonScript's features include a clean syntax, table comprehensions, implicit return, classes and inheritance, scope management, and object creation.

MoonScript uses significant whitespace, avoiding the keyword noise typically seen in a Lua script. Table comprehensions provide for concise list creation, and its functions automatically return the last evaluated expression. MoonScript supports classes and inheritance, import and export statements help manage scope, and the with statement simplifies object creation in MoonScript.

The project's source code is available on GitHub, and MoonScript can be installed using LuaRocks. Precompiled Windows binaries are available for easy installation.

Supporters of MoonScript hold that it provides an elegant and efficient way to write Lua code, making development more enjoyable for programmers.

This part of our computer programming language guide focuses on MoonScript.



Recommended Resources

Search for MoonScript on Google or Bing