Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ MoonScript

MoonScript

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Twisol   USA  (2,257 posts)  Bio
Date Thu 18 Aug 2011 01:05 AM (UTC)
Message
I found this compiles-to-Lua language recently called MoonScript [1], which is inspired by CoffeeScript [2]. I thought it would be pretty interesting to get it to work with MUSHclient, and it's really easy. If you just throw the "moonscript" directory from the project into MUSHclient/lua/, you can require("moonscript") from your script file or plugin and it'll make ".moon" versions of the package.path paths. Then you can require("foo") and if there's a foo.moon in scope it'll compile it to Lua on the fly. So it's extremely easy to use.

I figured I'd mention it here in case someone else wants to try it out. It might be nice to see MUSHclient ship with Moonscript one day, since it's not that large. Its only relevant dependency is lpeg, which we already have.


[1]: http://moonscript.org/
[2]: http://jashkenas.github.com/coffee-script/

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #1 on Thu 18 Aug 2011 03:24 AM (UTC)

Amended on Thu 18 Aug 2011 03:25 AM (UTC) by Fiendish

Message
I've been following the MoonScript announcements on the lua-l mailing list, and I have to say I'm completely turned off by any language that cares significantly about white space. It's one of the aspects of Python that I'd remove if given the chance to beat the designers into submission.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Thu 18 Aug 2011 04:08 AM (UTC)
Message
I tend to agree, but it -is- nice to have a slightly higher-level dialect of Lua. My only real gripe at this point is the choice of \ where normal Lua uses : .

As an aside: while the examples use module(), it's possible and easy to go for a straight return-this-table sort of module.

add = (a, b) -> a + b
subtract = (a, b) -> a - b

return {
  add: add,
  subtract: subtract
}


It's arguably even easier in MoonScript because everything's local by default. While this method ignores 'export', it was still useful for defining plugin callbacks in the global space.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 18 Aug 2011 08:57 PM (UTC)
Message
Your suggestion is noted, although I too am not a great fan of languages that depend on whitespace (eg. Make files are an example, which distinguish between tabs and spaces, which makes it hard to show them on a web page).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,519 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.