What are Minetest modders' thoughts on MoonScript?
MoonScript is a programming language that "compiles to Lua". That is, it's a programming language that's implemented as a MoonScript-to-Lua translator. Effectively, it's an alternative syntax for Lua. It adds some features clearly inspired by Python (like whitespace sensitivity, assignment to local rather than global variables by default, and list comprehensions) but also has a Perlish flavor (There Is More Than One Way to Do It, you don't need parentheses to call functions, and the syntax is made more concise by creative use of punctuation, as in function definitions).
I'm a fan of MoonScript. I find it pleasanter to work with than plain Lua. My only big complaint is that it's too strict about newlines. You can't just continue expressions on multiple lines by surrounding them with parentheses, as in Python. Newlines can only continue an expression after a comma. I try to get around this with 'do', as in:
I'm a fan of MoonScript. I find it pleasanter to work with than plain Lua. My only big complaint is that it's too strict about newlines. You can't just continue expressions on multiple lines by surrounding them with parentheses, as in Python. Newlines can only continue an expression after a comma. I try to get around this with 'do', as in:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
inside = (lo, p, hi) ->
lo.x <= p.x and lo.y <= p.y and lo.z <= p.z and do
hi.x >= p.x and hi.y >= p.y and hi.z >= p.z