[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Can luajit add a new ffi API for re-initialize a cdata?
- From: Zhu Ya Dong <lordix@...>
- Date: Wed, 16 Mar 2011 02:44:40 +0800
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