Todo List - Moonscript Typing CST Test
Loading…
Todo List — Moonscript Code
Maintains a simple todo list with add and remove functions.
todos = {}
updateUI = ->
print "Todo List:"
for i, task in ipairs todos
print "#{i}. #{task}"
print "----------------"
addTask = (task) ->
table.insert todos, task
updateUI!
removeTask = (index) ->
table.remove todos, index
updateUI!
# Simulate actions
addTask 'Buy milk'
addTask 'Write MoonScript code'
removeTask 1Moonscript Language Guide
MoonScript is a high-level, dynamic programming language that compiles to Lua. It provides syntactic sugar, cleaner syntax, and modern language features like classes, comprehensions, and pattern matching, while maintaining full compatibility with Lua runtime.
Primary Use Cases
- ▸Scripting for games (Love2D, Roblox)
- ▸Writing concise Lua programs
- ▸Rapid prototyping in Lua environments
- ▸Embedding in applications with Lua runtime
- ▸Creating libraries compatible with Lua
Notable Features
- ▸Class-based object system
- ▸Function comprehensions and expressions
- ▸Destructuring assignments
- ▸Cleaner control flow syntax
- ▸Direct interop with Lua code
Origin & Creator
Created by Leaf Corcoran in 2012 as a way to make Lua programming more ergonomic and expressive.
Industrial Note
MoonScript is used in gaming, embedded scripting, and applications where Lua is standard but developers want a more modern syntax and workflow.