Page 1 of 1

What are Minetest modders' thoughts on MoonScript?

PostPosted: Sun Jan 05, 2014 20:42
by Kodiologist
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:

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

PostPosted: Sun Jan 05, 2014 20:49
by Pitriss
oh noes, whitespace senistive code..

PostPosted: Mon Jan 06, 2014 09:17
by webdesigner97
-1000
Don't change the modding frontend, but improve the backend.

PostPosted: Mon Jan 06, 2014 15:50
by Krock
Old:
C++ -> LUA -> C++

New:
C++ -> LUA -> MoonScript -> LUA -> C++

I don't know how you see this but for me it looks like an useless addition.
We already have a common programming language avaliable to use.

EDIT: the ++ should be italic...does not seem to work

PostPosted: Mon Jan 06, 2014 16:12
by kaeza
I haven't tried Moonscript yet, but from your example code it looks much less readable than Lua. Another thing is that the majority of the (modding) community has knowledge about Lua, and adding yet another language will reduce the amount of people capable of helping you with development.

This is just my humble opinion. If you feel more comfortable with Moonscript, by all means use it.

Krock wrote:LUA

Lua is not an acronym.

PostPosted: Mon Jan 06, 2014 19:33
by xyz
Great news! This topic is not about adding MoonScript to Minetest since it's already here! And the best thing is — you can't do anything about it because as OP stated, MoonScript compiles to Lua.

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
minetest.register_on_chat_message (name, message) ->
    if message == "hi"
        minetest.chat_send_all("Hello, #{name}!")


minetest.register_node("moon:test", {
    description: "MoonScript is awesome!",
    on_place: ->
        print "I was placed! Awesome!"
})

PostPosted: Fri Jan 10, 2014 09:13
by prestidigitator
Inspiration from Python? Ick! Why not FORTRAN? Or LISP? Hmm. LISP to Lua conversion tool. We might be on to something.... :-P