Fat Arrows

Because it is an idiom in Lua to send an object as the first argument when calling a method, a special syntax is provided for creating functions which automatically includes a self argument.

MoonScript:

func = (num) => @value + num

Lua:

local func
func = function(self, num)
  return self.value + num
end

results matching ""

    No results matching ""