lua-users home
lua-l archive

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


I just found this on Hacker News

https://gist.github.com/2211379

It relies on an FFI library, altough I don't know if it is the one
from LuaJIT, James McKaskill's, or both (since they are mostly
compatible). I didn't test it (no Mac at hand).

Documentation:
-- Usage:
-- Loading a class: objc_loadClass("MyClass")
-- Creating objects: MyClass.new() or MyClass.alloc().init()
   -- Retaining&Releasing objects is handled by the lua garbage
collector so you should never need to call retain/release
-- Calling methods: myInstance:doThis_withThis_andThat(this, this, that)
   -- Colons in selectors are converted to underscores (last one being optional)
-- Creating blocks: objc_createBlock(myFunction, returnType, argTypes)
   -- returnType: An encoded type specifying what the block should
return (Consult
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html
for reference)
   -- argTypes: An array of encoded types specifying the argument
types the block expects
   -- Both return and argument types default to void if none are passed

Good stuff.

-- Pierre-Yves