local ffi = jit and require('ffi') or require('cffi')
ffi.cdef[[
typedef struct point {
int x;
int y;
} point_t;
]]
local points = ffi.new("point_t[4]")
points[0] = {1, 2} --> expected: no error, get: cannot convert 'table' to 'struct point'
print(points[0].x, points[0].y) --> 1 2
I don't actually use this one, but happened to stumble across it. I didn't realize the LuaJIT FFI allowed it.
I don't actually use this one, but happened to stumble across it. I didn't realize the LuaJIT FFI allowed it.