> In your first case, did you mean to say 'abc' ? For copying 3 bytes? See, that's why I think it can lead to subtle bugs: it copies 'ab\0'. It's even harder to spot when you see code like this: local cdata = ffi.new('unsigned char[?]', #s, s) which instead should be: local cdata = ffi.new('unsigned char[?]', #s+1, s) The behavior is documented, just IMHO a bit inconsistent.