lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Jun 17, 2014 at 11:26 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Tue, Jun 17, 2014 at 3:55 PM, leaf corcoran <leafot@gmail.com> wrote:
>> The biggest feature of this new release is a proper Lua API. If
>> MoonScript isn't your thing you can now write entire applications
>> without touching a line of it.
>
> [...] also seems the OOP style is less obtrusive, or am i getting more tolerant?

The MoonScript API stil relies on its OO features.

    lapis = require "lapis"

    class extends lapis.Application
      "/": =>
        "Hello world!"

The "proper Lua API" is independant and idiomatic.

    local lapis = require "lapis"
    local app = lapis.Application()

    app:match("/", function(self)
      return "Hello world!"
    end)

    return app