瞎扯淡 moonscript:看了一部分文档,老外真够懒的!

zfjoy520 · 2014年04月24日 · 最后由 dorentus 回复于 2014年04月26日 · 4642 次阅读

moonscript: A programmer friendly language that compiles to Lua.

http://moonscript.org/

MoonScript is a dynamic scripting language that compiles into Lua. It gives you the power of one of the fastest scripting languages combined with a rich set of features.

最近在研究 lua。文档看了一大半。越往后看,越觉得地球人已经无法阻止该语言的发明者偷懒了。

有兴趣的童鞋可以关注一下,只是稍稍有点不喜他这个靠严格缩进来支撑的逻辑。

抄几句官网的 code:

func_a = -> for i=1,10 do i

class Inventory
  new: =>
    @items = {}

  add_item: (name) =>
    if @items[name]
      @items[name] += 1
    else
      @items[name] = 1

真心有点叼炸天的感觉。

很刁吗?

这个看起来和 CoffeeScript 差不多,都是缩进,语法也类似。我觉得这个挺好的。

Coffee 要是能转成 lua 就好了,写一次可以同时转成 js,lua

匿名 #4 2014年04月26日

看起来不错 终于可以以我能理解的方式写魔兽世界插件了。。。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号