Using ffi ctype in a table

  • From: Jeff Slutter <jeff@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 03 Oct 2012 11:43:04 -0400

I was playing around with LuaJIT's FFI today and noticed a peculiarity and was curious...

Is there a reason why the following snippet of code prints:

true true nil

When I would expect it to be:

true true true


ffi = require('ffi')
typedef struct foo { int a, b; } foo_t;

typeFoo = ffi.typeof('foo_t')
foo = typeFoo()
typeList = {}
typeList[typeFoo] = true

print( typeFoo==ffi.typeof(foo), typeList[typeFoo], typeList[ffi.typeof(foo)] )



Other related posts: