begin lua ffi conversion for image loading