lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Mike,

I'm using luajit2 in my personal project and I love it so much^^.

And here are a requirement which I think maybe useful:
If we use ffi.new() create a instance of a struct like below
--start--
ffi.cdef[[typedef struct point{int x; int y;};]]
pt = ffi.new('struct point', {1, 2})
--end--
If we then want change 'pt' to (10, 20), instead do staff like "pt.x=10;pt.y=20",
can we do it like this:
--start--
ffi.renew(pt, {10, 20})
--end--

Thanks,
Zhu Ya Dong