Closed vsergeev closed 4 years ago
local ffi = jit and require('ffi') or require('cffi') ffi.cdef[[ typedef struct point { int x; int y; } point_t; ]] local points1 = ffi.new("point_t[4]") local points2 = ffi.new("point_t[4]") local cpoints2 = ffi.cast("const point_t *", points2) print(points1[0].x, points1[0].y) --> 0 0 points2[0].x = 1 points2[0].y = 2 points1[0] = cpoints2[0] --> expected: no error, get: cannot convert 'struct point' to 'struct point' print(points1[0].x, points1[0].y) --> 1 2