Skip to content

Commit b4415b8

Browse files
authored
docs (#5)
1 parent 9bcb0c1 commit b4415b8

6 files changed

Lines changed: 76 additions & 48 deletions

File tree

docs/ABOUT.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
# About
1+
# About MoonScript
22

3-
<!-- TODO: write document
3+
MoonScript was created by [Leaf Corcoran][leafo] as a more streamlined and "friendlier" alternative to [Lua][lua], a popular scripting language known for its speed and embeddability.
4+
Often described as "CoffeeScript for Lua," MoonScript's design philosophy centers on readability and ease of use, aiming to reduce the verbosity of Lua while retaining its core strengths.
5+
It achieves this by transpiling its code directly into standard Lua, meaning it can run on any platform that supports a Lua interpreter.
46

5-
This document contains a short introduction to the language.
7+
The primary function of MoonScript is to provide a more elegant and developer-friendly syntax for writing code that ultimately runs as Lua.
8+
It introduces features not native to Lua, such as classes, list comprehensions, and a more intuitive syntax for table manipulation.
9+
By compiling to Lua, it allows developers to leverage the vast ecosystem of existing Lua libraries and frameworks without modification, offering the best of both worlds: a modern, expressive syntax with the performance and portability of a well-established language.
610

7-
The introduction should be relatively brief and touch upon what
8-
makes the language interesting (and possibly unique). The goal
9-
is to help students decide if they want to join this track.
11+
Due to its nature as a Lua preprocessor, MoonScript finds its home in many of the same domains as Lua itself.
12+
It is particularly popular in game development, especially within game engines that use Lua for scripting, such as LÖVE 2D and Defold.
13+
Its concise syntax allows for faster development and easier maintenance of game logic.
14+
Beyond gaming, it is also used in web development, with frameworks like Lapis (which was also created by the author of MoonScript) and OpenResty, and for general-purpose scripting and application development.
1015

11-
The contents of this document are displayed on the track page,
12-
provided the student has not joined the track.
16+
To learn more about MoonScript, the official website at [moonscript.org][moon] is the best starting point.
17+
The community, while smaller than that of more mainstream languages, is active on platforms like [GitHub][github] and [Discord][discord].
18+
For those familiar with Lua, the transition is often smooth, as MoonScript's syntax is designed to be intuitive and easy to pick up.
1319

14-
See https://exercism.org/docs/building/tracks/docs for more information. -->
20+
[leafo]: https://leafo.net
21+
[lua]: https://exercism.org/tracks/lua/about
22+
[moon]: https://moonscript.org
23+
[github]: https://github.com/leafo/moonscript
24+
[discord]: https://discord.gg/Y75ZXrD

docs/INSTALLATION.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
# Installation
1+
# Installing MoonScript
22

3-
<!-- TODO: write document
3+
First, follow the installation instructions on [the Lua track][lua-install] to install Lua and busted.
44

5-
This document should describe what the student needs to install
6-
to allow working on the track on their local system using the CLI.
5+
Then, install MoonScript with
76

8-
You can include the installation instructions in this document, but
9-
usually it is better to link to a resource with the official installation
10-
instructions, to prevent the instructions from becoming outdated.
7+
```console
8+
$ luarocks install --local moonscript
9+
```
1110

12-
The contents of this document are displayed on the track's documentation
13-
page at `https://exercism.org/docs/tracks/<track>/installation`.
14-
15-
See https://exercism.org/docs/building/tracks/docs for more information. -->
11+
[lua-install]: https://exercism.org/docs/tracks/lua/installation

docs/LEARNING.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# Learning
1+
# How to Learn MoonScript
22

3-
<!-- TODO: write document
3+
Read [An Overview of MoonScript][leafo] by Leafo, MoonScript's creator.
4+
This is a great starting point if you're new to both MoonScript and Lua, explaining fundamental concepts.
45

5-
This document should link to learning resources.
6+
The primary spot for Learning Resources is [the MoonScript website][learn].
7+
It assumes you are already familiar with Lua.
68

7-
Feel free to link to any good learning resources you know, whether they
8-
be websites, blogs, books, videos or courses.
9-
10-
The contents of this document are displayed on the track's documentation
11-
page at `https://exercism.org/docs/tracks/<track>/learning`.
12-
13-
See https://exercism.org/docs/building/tracks/docs for more information. -->
9+
[leafo]: https://leafo.net/posts/An_overview_of_MoonScript.html
10+
[learn]: https://moonscript.org/#learning

docs/RESOURCES.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
# Resources
1+
# MoonScript Resources
22

3-
<!-- TODO: write document
3+
* [Official MoonScript Language Guide][guide]:
4+
The definitive resource for learning the language, covering its syntax and features in detail.
5+
It's best if you have some basic Lua familiarity.
46

5-
This document should link to useful resources.
7+
* [Learn MoonScript in Y Minutes][xiny]:
8+
For a quick, high-level introduction to the language's core features.
69

7-
Feel free to link to any good resources you know, whether they
8-
be websites, videos, mailing lists, etc.
10+
* MoonScript [Online Compiler][onlin]:
11+
Allows you to experiment with MoonScript code directly in your browser without any installation.
912

10-
The contents of this document are displayed on the track's documentation
11-
page at `https://exercism.org/docs/tracks/<track>/resources`.
13+
* [GitHub Repository][github]:
14+
The source code and community hub for MoonScript.
1215

13-
See https://exercism.org/docs/building/tracks/docs for more information. -->
16+
If MoonScript intrigues you, you might want to follow up with [YueScript][yuescript] which is based on MoonScript and extends it.
17+
18+
[guide]: https://moonscript.org/
19+
[xiny]: https://learnxinyminutes.com/docs/moonscript/
20+
[online]: https://moonscript.org/compiler/
21+
[github]: https://github.com/leafo/moonscript
22+
[yuescript]: https://yuescript.org

docs/SNIPPET.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
TODO: add snippet
1+
class Greet
2+
new: (@who) =>
3+
__tostring: => "Hello, #{@who}!"
4+
5+
print Greet thing for thing in *{'Me', 'You', 'World'}

docs/TESTS.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
# Tests
1+
# Testing on the MoonScript Track
22

3-
<!-- TODO: write document
3+
Testing on the MoonScript track is exactly like [testing on the Lua track][lua-tests].
4+
From an exercise directory, enter:
45

5-
This document should describe everything related to running tests in the track.
6+
```console
7+
$ busted
8+
```
69

7-
If your track uses skipped tests, this document can explain why thet is used and
8-
how to unskip tests.
10+
## Pending tests
911

10-
This document can also link to the testing framework documentation.
12+
This track follows Exercism's [Test-Driven Development][tdd] methodology.
13+
You are given a complete test suite, but only the first test is "active".
1114

12-
The contents of this document are displayed on the track's documentation
13-
page at `https://exercism.org/docs/tracks/<track>/tests`.
15+
To enable the tests, change a test's command from `pending` to `it`.
1416

15-
See https://exercism.org/docs/building/tracks/docs for more information. -->
17+
For those of you that like to run all the tests all the time, you can use a command-line tool to change them all at once.
18+
Here's an example using perl (which is installed just about everywhere):
19+
20+
```console
21+
$ perl -i -pe 's/^\s+\Kpending\b/it/' two_fer_spec.moon
22+
```
23+
24+
When you are working in the online editor, the test runner will automatically run all the tests.
25+
26+
[lua-tests]: https://exercism.org/docs/tracks/lua/tests
27+
[tdd]: https://exercism.org/docs/using/solving-exercises/tdd

0 commit comments

Comments
 (0)