News for hackers. Stuff that matters.
Re:TLC, a tiny lua cocoa bridge by atilimcetin on Wednesday March 28, 2012 @09:29AM (#3766094)
Is it using LuaJIT or any another ffi library?
Re:TLC, a tiny lua cocoa bridge by pygy_ on Wednesday March 28, 2012 @10:24AM (#3766353)
James McKaskill ported LuaJIT's FFI to standard (PUC) Lua, but there are a few differences. I don't know for which one it was developed.

https://github.com/jmckaskill/luaffi

Re:TLC, a tiny lua cocoa bridge by chrisdevereux on Wednesday March 28, 2012 @09:47AM (#3766197)
Re:TLC, a tiny lua cocoa bridge by fyolnish on Wednesday March 28, 2012 @10:27AM (#3766368)
Yes, it does indeed require LuaJIT. (I probably should indicate this more clearly in the source)
Re:TLC, a tiny lua cocoa bridge by pygy_ on Wednesday March 28, 2012 @10:35AM (#3766411)
Did you try it in vanilla Lua with the FFI port linked in a sibling of your post?
Re:TLC, a tiny lua cocoa bridge by fyolnish on Wednesday March 28, 2012 @10:47AM (#3766476)
Nope, can't say I have.
Re:TLC, a tiny lua cocoa bridge by akadien on Wednesday March 28, 2012 @10:17AM (#3766320)
It's LuaJIT (FFI). Legacy wrappers involve mostly C code and a lot of code managing metatables.
Re:TLC, a tiny lua cocoa bridge by dubya on Wednesday March 28, 2012 @09:34AM (#3766125)
I know exactly zero Lua, but

  if ffi == nil then
  	ffi = require("ffi")
  end
is suggestive.
Re:TLC, a tiny lua cocoa bridge by gregholmberg on Wednesday March 28, 2012 @03:37PM (#3767961)
There are some idioms in Lua that you might recognize from Python or Ruby. I have seen this one in Perl and the Bourne shell, as well.

  ffi = ffi or require("ffi")
If the ffi expression evaluates to something that is not nil, we keep the previous value of ffi. The assignment becomes a no-op.

If it evaluates to a nil, we initialize it by calling require().