Re:TLC, a tiny lua cocoa bridge
by fyolnish on Wednesday March 28, 2012 @11:07AM
(#3766598)
There's no need to load a framework since linking to a framework means all of it's classes are added to the runtime.
You simply request the class you want. That is, if you are embedding lua in your app.
I haven't tried using TLC from the standalone luajit interpreter, but in that case you would probably have to use fii.load() to load the Framework & libobjc before being able to use objc. But that is not what it was designed for
To translate a LuaCocoa example you'd in most cases just have to add objc_loadClass calls for any class you want to use, and use dots instead of colons to call methods (obj:method() -> obj.method() ).
Re:TLC, a tiny lua cocoa bridge
by wildmXranat on Wednesday March 28, 2012 @10:32AM
(#3766396)
Hmm, this looks very interesting. Could it be used as a scripting layer within a OSX/iOS application or could you whip up a complete application with this ?
Re:TLC, a tiny lua cocoa bridge
by hjaltij on Wednesday March 28, 2012 @12:19PM
(#3766971)
Take a look at the app that the OP is building. It's pretty interesting and uses this scripting bridge for generating OpenGL visuals. (http://github.com/aptiva/tranquil)
Re:TLC, a tiny lua cocoa bridge
by fyolnish on Wednesday March 28, 2012 @10:38AM
(#3766426)
Well, the biggest difference is that it's written in Lua. And it uses LuaJIT not vanilla Lua. (LuaJIT being orders of magnitude faster)
And from what I can tell, iphonewax is intended for writing entire apps in lua, this project is intended to be used when embedding bits of lua code in your objc app. (But there's nothing stopping you from writing most of your app in it)
What I found instead is beautiful.
Can you load a framework with this? I know hardly anything about Objective-C.
I haven't tried using TLC from the standalone luajit interpreter, but in that case you would probably have to use fii.load() to load the Framework & libobjc before being able to use objc. But that is not what it was designed for
To translate a LuaCocoa example you'd in most cases just have to add objc_loadClass calls for any class you want to use, and use dots instead of colons to call methods (obj:method() -> obj.method() ).
It doesn't support subclassing objective-c objects so that would probably limit you if you tried to write your app exclusively in lua.
And from what I can tell, iphonewax is intended for writing entire apps in lua, this project is intended to be used when embedding bits of lua code in your objc app. (But there's nothing stopping you from writing most of your app in it)
https://github.com/jmckaskill/luaffi
If it evaluates to a nil, we initialize it by calling require().