lua-users home
lua-l archive

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


On Sat, Oct 3, 2015 at 10:38 PM, Simon Cozens <simon@simon-cozens.org> wrote:
> Hello all,
>         I'm in the middle of embedding Lua into an OS X app, and none of the
> other ObjC bridges quite worked for me; they were either actually not
> working at all, or difficult to install, or had horrific non-Lua-like
> syntax on the Lua end.
>
>         So I took the best I could find (EasyLua,
> https://github.com/CrimsonMoonEntertainment) and messed about with the
> syntax, improved the number of data structures that could be marshalled,
> made it easier to install, and here we go:
>
>         https://github.com/simoncozens/NSLua
>
>         Now you can write code like:
>
> fileurl = NSURL:fileURLWithPath_(path)
> dc = NSDocumentController.sharedDocumentController
> dc:openDocumentWithContentsOfURL_display_error_(fileurl, true, nil)
>
> Have fun,
> S
>

Just wondering if you had considered an API like:

dc:openDocumentWithContentsOfURL{fileurl, display=true, error=nil}

This would make it somewhat more readable and much more like the
original ObjC code. It's faintly un-Lua-ish but not significantly so
IMO.

I'm not a fan of NextStep-like naming conventions on the first place,
but if I'm going to use them, I at least want them to remain readable;
pulling out all of the infixes and making them prefixes makes it even
more unattractive than ObjC code on its own.

/s/ Adam