Yes.  I'm a bit worried about the way I'm mapping Lua objects to packet memory, though.  An expert review of my ffi.cast-ing would certainly be appreciated :) 

Some parts are clearly suboptimal, like the header:clone() thing combined with datagram:push(), which actually copies the header twice.

All in all, I'm not perfectly happy with this solution.