|
You might also check out LuaCocoa. It uses libffi under the hood forOn 11/18/16, Chris Jones <cmsj@tenshu.net> wrote:
> Hey
>
>> On 18 Nov 2016, at 10:24, Simon Cozens <simon@simon-cozens.org> wrote:
>> Yep, my NSLua (https://github.com/simoncozens/NSLua - heavily based on
>> EasyLua) gives you a bidirectional bridge between Lua and ObjC.
>>
>> What exactly are you looking for? Are you embedding Lua in an ObjC app,
>> or something else?
>
> Thanks for the swift reply!
>
> I currently maintain Hammerspoon (http://www.hammerspoon.org/) which uses
> Lua to expose a whole raft of OS X APIs to users (window management being
> probably the most used part).
>
> Right now I'm investigating how reasonable it would be to allow users to
> interact directly with ObjC objects from Lua (effectively allowing new OS
> API plugins to be written in pure Lua). What potentially makes this harder
> is that we already have a homegrown NSObject wrapper around Lua
> (https://github.com/Hammerspoon/hammerspoon/tree/ ), whichmaster/LuaSkin
> provides some interfacing between the two, but not anything like FFI (mainly
> around converting data back and forth). I had looked at some of the
> Lua<->Cocoa bridges before, but since they generally also want to manage the
> lua_State object, it's not a simple drop-in thing :)
>
> Cheers,
> Chris
>
some things. Maybe it could give you some ideas.
Or maybe you might be able to use it. While not perfect (some things I
would like to clean up), LuaCocoa does very hard to adhere to the Lua
philosophy of "mechanisms, not policy" and not impose on you to
conform to it (be a library and not a framework). LuaCocoa does allow
you to use a lua_State that you created yourself.
LuaCocoa uses BridgeSupport (which is part of Mac OS X) to fully and
automatically and correctly bridge all APIs on the system.
http://playcontrol.net/opensource/LuaCocoa/
I gave a talk on its design last month at the Lua Workshop. The videos
are supposed to go up soon.
-Eric